mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge remote-tracking branch 'refs/remotes/Microsoft/master'
This commit is contained in:
@@ -49,7 +49,7 @@ function createCancellationToken(args) {
|
||||
return {
|
||||
isCancellationRequested: function () { return perRequestPipeName_1 !== undefined && pipeExists(perRequestPipeName_1); },
|
||||
setRequest: function (requestId) {
|
||||
currentRequestId_1 = currentRequestId_1;
|
||||
currentRequestId_1 = requestId;
|
||||
perRequestPipeName_1 = namePrefix_1 + requestId;
|
||||
},
|
||||
resetRequest: function (requestId) {
|
||||
|
||||
Vendored
+549
-329
File diff suppressed because it is too large
Load Diff
Vendored
+240
-121
@@ -98,8 +98,8 @@ interface ConstrainLongRange extends LongRange {
|
||||
}
|
||||
|
||||
interface ConstrainVideoFacingModeParameters {
|
||||
exact?: string | string[];
|
||||
ideal?: string | string[];
|
||||
exact?: VideoFacingModeEnum | VideoFacingModeEnum[];
|
||||
ideal?: VideoFacingModeEnum | VideoFacingModeEnum[];
|
||||
}
|
||||
|
||||
interface CustomEventInit extends EventInit {
|
||||
@@ -328,7 +328,7 @@ interface MSAudioSendSignal {
|
||||
}
|
||||
|
||||
interface MSConnectivity {
|
||||
iceType?: string;
|
||||
iceType?: MSIceType;
|
||||
iceWarningFlags?: MSIceWarningFlags;
|
||||
relayAddress?: MSRelayAddress;
|
||||
}
|
||||
@@ -338,11 +338,11 @@ interface MSCredentialFilter {
|
||||
}
|
||||
|
||||
interface MSCredentialParameters {
|
||||
type?: string;
|
||||
type?: MSCredentialType;
|
||||
}
|
||||
|
||||
interface MSCredentialSpec {
|
||||
type?: string;
|
||||
type?: MSCredentialType;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ interface MSDelay {
|
||||
|
||||
interface MSDescription extends RTCStats {
|
||||
connectivity?: MSConnectivity;
|
||||
transport?: string;
|
||||
transport?: RTCIceProtocol;
|
||||
networkconnectivity?: MSNetworkConnectivityInfo;
|
||||
localAddr?: MSIPAddressInfo;
|
||||
remoteAddr?: MSIPAddressInfo;
|
||||
@@ -477,11 +477,11 @@ interface MSTransportDiagnosticsStats extends RTCStats {
|
||||
numConsentRespReceived?: number;
|
||||
interfaces?: MSNetworkInterfaceType;
|
||||
baseInterface?: MSNetworkInterfaceType;
|
||||
protocol?: string;
|
||||
protocol?: RTCIceProtocol;
|
||||
localInterface?: MSNetworkInterfaceType;
|
||||
localAddrType?: string;
|
||||
remoteAddrType?: string;
|
||||
iceRole?: string;
|
||||
localAddrType?: MSIceAddrType;
|
||||
remoteAddrType?: MSIceAddrType;
|
||||
iceRole?: RTCIceRole;
|
||||
rtpRtcpMux?: boolean;
|
||||
allocationTimeInMs?: number;
|
||||
msRtcEngineVersion?: string;
|
||||
@@ -554,7 +554,7 @@ interface MediaEncryptedEventInit extends EventInit {
|
||||
}
|
||||
|
||||
interface MediaKeyMessageEventInit extends EventInit {
|
||||
messageType?: string;
|
||||
messageType?: MediaKeyMessageType;
|
||||
message?: ArrayBuffer;
|
||||
}
|
||||
|
||||
@@ -562,8 +562,8 @@ interface MediaKeySystemConfiguration {
|
||||
initDataTypes?: string[];
|
||||
audioCapabilities?: MediaKeySystemMediaCapability[];
|
||||
videoCapabilities?: MediaKeySystemMediaCapability[];
|
||||
distinctiveIdentifier?: string;
|
||||
persistentState?: string;
|
||||
distinctiveIdentifier?: MediaKeysRequirement;
|
||||
persistentState?: MediaKeysRequirement;
|
||||
}
|
||||
|
||||
interface MediaKeySystemMediaCapability {
|
||||
@@ -687,7 +687,7 @@ interface MutationObserverInit {
|
||||
}
|
||||
|
||||
interface NotificationOptions {
|
||||
dir?: string;
|
||||
dir?: NotificationDirection;
|
||||
lang?: string;
|
||||
body?: string;
|
||||
tag?: string;
|
||||
@@ -786,8 +786,8 @@ interface PushSubscriptionOptionsInit {
|
||||
|
||||
interface RTCConfiguration {
|
||||
iceServers?: RTCIceServer[];
|
||||
iceTransportPolicy?: string;
|
||||
bundlePolicy?: string;
|
||||
iceTransportPolicy?: RTCIceTransportPolicy;
|
||||
bundlePolicy?: RTCBundlePolicy;
|
||||
peerIdentity?: string;
|
||||
}
|
||||
|
||||
@@ -801,7 +801,7 @@ interface RTCDtlsFingerprint {
|
||||
}
|
||||
|
||||
interface RTCDtlsParameters {
|
||||
role?: string;
|
||||
role?: RTCDtlsRole;
|
||||
fingerprints?: RTCDtlsFingerprint[];
|
||||
}
|
||||
|
||||
@@ -809,7 +809,7 @@ interface RTCIceCandidateAttributes extends RTCStats {
|
||||
ipAddress?: string;
|
||||
portNumber?: number;
|
||||
transport?: string;
|
||||
candidateType?: string;
|
||||
candidateType?: RTCStatsIceCandidateType;
|
||||
priority?: number;
|
||||
addressSourceUrl?: string;
|
||||
}
|
||||
@@ -821,10 +821,10 @@ interface RTCIceCandidateDictionary {
|
||||
foundation?: string;
|
||||
priority?: number;
|
||||
ip?: string;
|
||||
protocol?: string;
|
||||
protocol?: RTCIceProtocol;
|
||||
port?: number;
|
||||
type?: string;
|
||||
tcpType?: string;
|
||||
type?: RTCIceCandidateType;
|
||||
tcpType?: RTCIceTcpCandidateType;
|
||||
relatedAddress?: string;
|
||||
relatedPort?: number;
|
||||
msMTurnSessionId?: string;
|
||||
@@ -845,7 +845,7 @@ interface RTCIceCandidatePairStats extends RTCStats {
|
||||
transportId?: string;
|
||||
localCandidateId?: string;
|
||||
remoteCandidateId?: string;
|
||||
state?: string;
|
||||
state?: RTCStatsIceCandidatePairState;
|
||||
priority?: number;
|
||||
nominated?: boolean;
|
||||
writable?: boolean;
|
||||
@@ -858,7 +858,7 @@ interface RTCIceCandidatePairStats extends RTCStats {
|
||||
}
|
||||
|
||||
interface RTCIceGatherOptions {
|
||||
gatherPolicy?: string;
|
||||
gatherPolicy?: RTCIceGatherPolicy;
|
||||
iceservers?: RTCIceServer[];
|
||||
portRange?: MSPortRange;
|
||||
}
|
||||
@@ -1023,7 +1023,7 @@ interface RTCRtpParameters {
|
||||
headerExtensions?: RTCRtpHeaderExtensionParameters[];
|
||||
encodings?: RTCRtpEncodingParameters[];
|
||||
rtcp?: RTCRtcpParameters;
|
||||
degradationPreference?: string;
|
||||
degradationPreference?: RTCDegradationPreference;
|
||||
}
|
||||
|
||||
interface RTCRtpRtxParameters {
|
||||
@@ -1037,7 +1037,7 @@ interface RTCRtpUnhandled {
|
||||
}
|
||||
|
||||
interface RTCSessionDescriptionInit {
|
||||
type?: string;
|
||||
type?: RTCSdpType;
|
||||
sdp?: string;
|
||||
}
|
||||
|
||||
@@ -1063,9 +1063,9 @@ interface RTCSsrcRange {
|
||||
|
||||
interface RTCStats {
|
||||
timestamp?: number;
|
||||
type?: string;
|
||||
type?: RTCStatsType;
|
||||
id?: string;
|
||||
msType?: string;
|
||||
msType?: MSStatsType;
|
||||
}
|
||||
|
||||
interface RTCStatsReport {
|
||||
@@ -1090,11 +1090,11 @@ interface RequestInit {
|
||||
headers?: any;
|
||||
body?: any;
|
||||
referrer?: string;
|
||||
referrerPolicy?: string;
|
||||
mode?: string;
|
||||
credentials?: string;
|
||||
cache?: string;
|
||||
redirect?: string;
|
||||
referrerPolicy?: ReferrerPolicy;
|
||||
mode?: RequestMode;
|
||||
credentials?: RequestCredentials;
|
||||
cache?: RequestCache;
|
||||
redirect?: RequestRedirect;
|
||||
integrity?: string;
|
||||
keepalive?: boolean;
|
||||
window?: any;
|
||||
@@ -1107,9 +1107,9 @@ interface ResponseInit {
|
||||
}
|
||||
|
||||
interface ScopedCredentialDescriptor {
|
||||
type?: string;
|
||||
type?: ScopedCredentialType;
|
||||
id?: any;
|
||||
transports?: string[];
|
||||
transports?: Transport[];
|
||||
}
|
||||
|
||||
interface ScopedCredentialOptions {
|
||||
@@ -1120,7 +1120,7 @@ interface ScopedCredentialOptions {
|
||||
}
|
||||
|
||||
interface ScopedCredentialParameters {
|
||||
type?: string;
|
||||
type?: ScopedCredentialType;
|
||||
algorithm?: string | Algorithm;
|
||||
}
|
||||
|
||||
@@ -1350,7 +1350,7 @@ interface AudioContextBase extends EventTarget {
|
||||
readonly listener: AudioListener;
|
||||
onstatechange: (this: AudioContext, ev: Event) => any;
|
||||
readonly sampleRate: number;
|
||||
readonly state: string;
|
||||
readonly state: AudioContextState;
|
||||
close(): Promise<void>;
|
||||
createAnalyser(): AnalyserNode;
|
||||
createBiquadFilter(): BiquadFilterNode;
|
||||
@@ -1410,12 +1410,13 @@ declare var AudioListener: {
|
||||
|
||||
interface AudioNode extends EventTarget {
|
||||
channelCount: number;
|
||||
channelCountMode: string;
|
||||
channelInterpretation: string;
|
||||
channelCountMode: ChannelCountMode;
|
||||
channelInterpretation: ChannelInterpretation;
|
||||
readonly context: AudioContext;
|
||||
readonly numberOfInputs: number;
|
||||
readonly numberOfOutputs: number;
|
||||
connect(destination: AudioNode, output?: number, input?: number): AudioNode;
|
||||
connect(destination: AudioParam, output?: number): void;
|
||||
disconnect(output?: number): void;
|
||||
disconnect(destination: AudioNode, output?: number, input?: number): void;
|
||||
disconnect(destination: AudioParam, output?: number): void;
|
||||
@@ -1513,7 +1514,7 @@ interface BiquadFilterNode extends AudioNode {
|
||||
readonly detune: AudioParam;
|
||||
readonly frequency: AudioParam;
|
||||
readonly gain: AudioParam;
|
||||
type: string;
|
||||
type: BiquadFilterType;
|
||||
getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void;
|
||||
}
|
||||
|
||||
@@ -2153,7 +2154,7 @@ interface CanvasRenderingContext2D extends Object, CanvasPathMethods {
|
||||
lineJoin: string;
|
||||
lineWidth: number;
|
||||
miterLimit: number;
|
||||
msFillRule: string;
|
||||
msFillRule: CanvasFillRule;
|
||||
shadowBlur: number;
|
||||
shadowColor: string;
|
||||
shadowOffsetX: number;
|
||||
@@ -2166,19 +2167,21 @@ interface CanvasRenderingContext2D extends Object, CanvasPathMethods {
|
||||
oImageSmoothingEnabled: boolean;
|
||||
beginPath(): void;
|
||||
clearRect(x: number, y: number, w: number, h: number): void;
|
||||
clip(fillRule?: string): void;
|
||||
clip(fillRule?: CanvasFillRule): void;
|
||||
createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData;
|
||||
createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;
|
||||
createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern;
|
||||
createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;
|
||||
drawFocusIfNeeded(element: Element): void;
|
||||
drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void;
|
||||
fill(fillRule?: string): void;
|
||||
drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, dstX: number, dstY: number): void;
|
||||
drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, dstX: number, dstY: number, dstW: number, dstH: number): void;
|
||||
drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, srcX: number, srcY: number, srcW: number, srcH: number, dstX: number, dstY: number, dstW: number, dstH: number): void;
|
||||
fill(fillRule?: CanvasFillRule): void;
|
||||
fillRect(x: number, y: number, w: number, h: number): void;
|
||||
fillText(text: string, x: number, y: number, maxWidth?: number): void;
|
||||
getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;
|
||||
getLineDash(): number[];
|
||||
isPointInPath(x: number, y: number, fillRule?: string): boolean;
|
||||
isPointInPath(x: number, y: number, fillRule?: CanvasFillRule): boolean;
|
||||
measureText(text: string): TextMetrics;
|
||||
putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void;
|
||||
restore(): void;
|
||||
@@ -2469,10 +2472,10 @@ declare var DOMException: {
|
||||
}
|
||||
|
||||
interface DOMImplementation {
|
||||
createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document;
|
||||
createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType | null): Document;
|
||||
createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType;
|
||||
createHTMLDocument(title: string): Document;
|
||||
hasFeature(): boolean;
|
||||
hasFeature(feature: string | null, version: string | null): boolean;
|
||||
}
|
||||
|
||||
declare var DOMImplementation: {
|
||||
@@ -2555,6 +2558,7 @@ interface DataTransfer {
|
||||
clearData(format?: string): boolean;
|
||||
getData(format: string): string;
|
||||
setData(format: string, data: string): boolean;
|
||||
setDragImage(image: Element, x: number, y: number): void;
|
||||
}
|
||||
|
||||
declare var DataTransfer: {
|
||||
@@ -2591,7 +2595,7 @@ declare var DataTransferItemList: {
|
||||
|
||||
interface DeferredPermissionRequest {
|
||||
readonly id: number;
|
||||
readonly type: string;
|
||||
readonly type: MSWebViewPermissionType;
|
||||
readonly uri: string;
|
||||
allow(): void;
|
||||
deny(): void;
|
||||
@@ -3209,7 +3213,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
|
||||
* Contains the title of the document.
|
||||
*/
|
||||
title: string;
|
||||
readonly visibilityState: string;
|
||||
readonly visibilityState: VisibilityState;
|
||||
/**
|
||||
* Sets or gets the color of the links that the user has visited.
|
||||
*/
|
||||
@@ -3224,7 +3228,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
|
||||
* Gets or sets the version attribute specified in the declaration of an XML document.
|
||||
*/
|
||||
xmlVersion: string | null;
|
||||
adoptNode(source: Node): Node;
|
||||
adoptNode<T extends Node>(source: T): T;
|
||||
captureEvents(): void;
|
||||
caretRangeFromPoint(x: number, y: number): Range;
|
||||
clear(): void;
|
||||
@@ -3401,7 +3405,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
|
||||
* Gets a value indicating whether the object currently has focus.
|
||||
*/
|
||||
hasFocus(): boolean;
|
||||
importNode(importedNode: Node, deep: boolean): Node;
|
||||
importNode<T extends Node>(importedNode: T, deep: boolean): T;
|
||||
msElementsFromPoint(x: number, y: number): NodeListOf<Element>;
|
||||
msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf<Element>;
|
||||
/**
|
||||
@@ -3469,6 +3473,7 @@ declare var Document: {
|
||||
}
|
||||
|
||||
interface DocumentFragment extends Node, NodeSelector, ParentNode {
|
||||
getElementById(elementId: string): HTMLElement | null;
|
||||
}
|
||||
|
||||
declare var DocumentFragment: {
|
||||
@@ -3716,9 +3721,9 @@ declare var Event: {
|
||||
}
|
||||
|
||||
interface EventTarget {
|
||||
addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
||||
dispatchEvent(evt: Event): boolean;
|
||||
removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
||||
}
|
||||
|
||||
declare var EventTarget: {
|
||||
@@ -3797,7 +3802,7 @@ declare var FocusEvent: {
|
||||
}
|
||||
|
||||
interface FocusNavigationEvent extends Event {
|
||||
readonly navigationReason: string;
|
||||
readonly navigationReason: NavigationReason;
|
||||
readonly originHeight: number;
|
||||
readonly originLeft: number;
|
||||
readonly originTop: number;
|
||||
@@ -3811,7 +3816,12 @@ declare var FocusNavigationEvent: {
|
||||
}
|
||||
|
||||
interface FormData {
|
||||
append(name: any, value: any, blobName?: string): void;
|
||||
append(name: string, value: string | Blob, fileName?: string): void;
|
||||
delete(name: string): void;
|
||||
get(name: string): FormDataEntryValue | null;
|
||||
getAll(name: string): FormDataEntryValue[];
|
||||
has(name: string): boolean;
|
||||
set(name: string, value: string | Blob, fileName?: string): void;
|
||||
}
|
||||
|
||||
declare var FormData: {
|
||||
@@ -6973,7 +6983,7 @@ declare var History: {
|
||||
}
|
||||
|
||||
interface IDBCursor {
|
||||
readonly direction: string;
|
||||
readonly direction: IDBCursorDirection;
|
||||
key: IDBKeyRange | IDBValidKey;
|
||||
readonly primaryKey: any;
|
||||
source: IDBObjectStore | IDBIndex;
|
||||
@@ -7125,7 +7135,7 @@ interface IDBRequest extends EventTarget {
|
||||
readonly error: DOMError;
|
||||
onerror: (this: IDBRequest, ev: Event) => any;
|
||||
onsuccess: (this: IDBRequest, ev: Event) => any;
|
||||
readonly readyState: string;
|
||||
readonly readyState: IDBRequestReadyState;
|
||||
readonly result: any;
|
||||
source: IDBObjectStore | IDBIndex | IDBCursor;
|
||||
readonly transaction: IDBTransaction;
|
||||
@@ -7147,7 +7157,7 @@ interface IDBTransactionEventMap {
|
||||
interface IDBTransaction extends EventTarget {
|
||||
readonly db: IDBDatabase;
|
||||
readonly error: DOMError;
|
||||
readonly mode: string;
|
||||
readonly mode: IDBTransactionMode;
|
||||
onabort: (this: IDBTransaction, ev: Event) => any;
|
||||
oncomplete: (this: IDBTransaction, ev: Event) => any;
|
||||
onerror: (this: IDBTransaction, ev: Event) => any;
|
||||
@@ -7265,7 +7275,7 @@ declare var KeyboardEvent: {
|
||||
|
||||
interface ListeningStateChangedEvent extends Event {
|
||||
readonly label: string;
|
||||
readonly state: string;
|
||||
readonly state: ListeningState;
|
||||
}
|
||||
|
||||
declare var ListeningStateChangedEvent: {
|
||||
@@ -7356,7 +7366,7 @@ declare var MSAppAsyncOperation: {
|
||||
|
||||
interface MSAssertion {
|
||||
readonly id: string;
|
||||
readonly type: string;
|
||||
readonly type: MSCredentialType;
|
||||
}
|
||||
|
||||
declare var MSAssertion: {
|
||||
@@ -7388,7 +7398,7 @@ interface MSFIDOCredentialAssertion extends MSAssertion {
|
||||
readonly algorithm: string | Algorithm;
|
||||
readonly attestation: any;
|
||||
readonly publicKey: string;
|
||||
readonly transportHints: string[];
|
||||
readonly transportHints: MSTransportType[];
|
||||
}
|
||||
|
||||
declare var MSFIDOCredentialAssertion: {
|
||||
@@ -7492,7 +7502,7 @@ interface MSHTMLWebViewElement extends HTMLElement {
|
||||
goForward(): void;
|
||||
invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation;
|
||||
navigate(uri: string): void;
|
||||
navigateFocus(navigationReason: string, origin: FocusNavigationOrigin): void;
|
||||
navigateFocus(navigationReason: NavigationReason, origin: FocusNavigationOrigin): void;
|
||||
navigateToLocalStreamUri(source: string, streamResolver: any): void;
|
||||
navigateToString(contents: string): void;
|
||||
navigateWithHttpRequestMessage(requestMessage: any): void;
|
||||
@@ -7747,7 +7757,7 @@ declare var MSWebViewSettings: {
|
||||
interface MediaDeviceInfo {
|
||||
readonly deviceId: string;
|
||||
readonly groupId: string;
|
||||
readonly kind: string;
|
||||
readonly kind: MediaDeviceKind;
|
||||
readonly label: string;
|
||||
}
|
||||
|
||||
@@ -7814,7 +7824,7 @@ declare var MediaError: {
|
||||
|
||||
interface MediaKeyMessageEvent extends Event {
|
||||
readonly message: ArrayBuffer;
|
||||
readonly messageType: string;
|
||||
readonly messageType: MediaKeyMessageType;
|
||||
}
|
||||
|
||||
declare var MediaKeyMessageEvent: {
|
||||
@@ -7842,7 +7852,7 @@ declare var MediaKeySession: {
|
||||
interface MediaKeyStatusMap {
|
||||
readonly size: number;
|
||||
forEach(callback: ForEachCallback): void;
|
||||
get(keyId: any): string;
|
||||
get(keyId: any): MediaKeyStatus;
|
||||
has(keyId: any): boolean;
|
||||
}
|
||||
|
||||
@@ -7863,7 +7873,7 @@ declare var MediaKeySystemAccess: {
|
||||
}
|
||||
|
||||
interface MediaKeys {
|
||||
createSession(sessionType?: string): MediaKeySession;
|
||||
createSession(sessionType?: MediaKeySessionType): MediaKeySession;
|
||||
setServerCertificate(serverCertificate: any): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -8001,7 +8011,7 @@ interface MediaStreamTrack extends EventTarget {
|
||||
onoverconstrained: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any;
|
||||
onunmute: (this: MediaStreamTrack, ev: Event) => any;
|
||||
readonly readonly: boolean;
|
||||
readonly readyState: string;
|
||||
readonly readyState: MediaStreamTrackState;
|
||||
readonly remote: boolean;
|
||||
applyConstraints(constraints: MediaTrackConstraints): Promise<void>;
|
||||
clone(): MediaStreamTrack;
|
||||
@@ -8222,7 +8232,7 @@ declare var NavigationEventWithReferrer: {
|
||||
interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorBeacon, NavigatorConcurrentHardware, NavigatorUserMedia {
|
||||
readonly authentication: WebAuthentication;
|
||||
readonly cookieEnabled: boolean;
|
||||
gamepadInputEmulation: string;
|
||||
gamepadInputEmulation: GamepadInputEmulationType;
|
||||
readonly language: string;
|
||||
readonly maxTouchPoints: number;
|
||||
readonly mimeTypes: MimeTypeArray;
|
||||
@@ -8269,15 +8279,15 @@ interface Node extends EventTarget {
|
||||
contains(child: Node): boolean;
|
||||
hasAttributes(): boolean;
|
||||
hasChildNodes(): boolean;
|
||||
insertBefore(newChild: Node, refChild: Node | null): Node;
|
||||
insertBefore<T extends Node>(newChild: T, refChild: Node | null): T;
|
||||
isDefaultNamespace(namespaceURI: string | null): boolean;
|
||||
isEqualNode(arg: Node): boolean;
|
||||
isSameNode(other: Node): boolean;
|
||||
lookupNamespaceURI(prefix: string | null): string | null;
|
||||
lookupPrefix(namespaceURI: string | null): string | null;
|
||||
normalize(): void;
|
||||
removeChild(oldChild: Node): Node;
|
||||
replaceChild(newChild: Node, oldChild: Node): Node;
|
||||
removeChild<T extends Node>(oldChild: T): T;
|
||||
replaceChild<T extends Node>(newChild: Node, oldChild: T): T;
|
||||
readonly ATTRIBUTE_NODE: number;
|
||||
readonly CDATA_SECTION_NODE: number;
|
||||
readonly COMMENT_NODE: number;
|
||||
@@ -8379,14 +8389,14 @@ interface NotificationEventMap {
|
||||
|
||||
interface Notification extends EventTarget {
|
||||
readonly body: string;
|
||||
readonly dir: string;
|
||||
readonly dir: NotificationDirection;
|
||||
readonly icon: string;
|
||||
readonly lang: string;
|
||||
onclick: (this: Notification, ev: Event) => any;
|
||||
onclose: (this: Notification, ev: Event) => any;
|
||||
onerror: (this: Notification, ev: Event) => any;
|
||||
onshow: (this: Notification, ev: Event) => any;
|
||||
readonly permission: string;
|
||||
readonly permission: NotificationPermission;
|
||||
readonly tag: string;
|
||||
readonly title: string;
|
||||
close(): void;
|
||||
@@ -8397,7 +8407,7 @@ interface Notification extends EventTarget {
|
||||
declare var Notification: {
|
||||
prototype: Notification;
|
||||
new(title: string, options?: NotificationOptions): Notification;
|
||||
requestPermission(callback?: NotificationPermissionCallback): Promise<string>;
|
||||
requestPermission(callback?: NotificationPermissionCallback): Promise<NotificationPermission>;
|
||||
}
|
||||
|
||||
interface OES_element_index_uint {
|
||||
@@ -8487,7 +8497,7 @@ interface OscillatorNode extends AudioNode {
|
||||
readonly detune: AudioParam;
|
||||
readonly frequency: AudioParam;
|
||||
onended: (this: OscillatorNode, ev: MediaStreamErrorEvent) => any;
|
||||
type: string;
|
||||
type: OscillatorType;
|
||||
setPeriodicWave(periodicWave: PeriodicWave): void;
|
||||
start(when?: number): void;
|
||||
stop(when?: number): void;
|
||||
@@ -8530,9 +8540,9 @@ interface PannerNode extends AudioNode {
|
||||
coneInnerAngle: number;
|
||||
coneOuterAngle: number;
|
||||
coneOuterGain: number;
|
||||
distanceModel: string;
|
||||
distanceModel: DistanceModelType;
|
||||
maxDistance: number;
|
||||
panningModel: string;
|
||||
panningModel: PanningModelType;
|
||||
refDistance: number;
|
||||
rolloffFactor: number;
|
||||
setOrientation(x: number, y: number, z: number): void;
|
||||
@@ -8583,7 +8593,7 @@ interface PaymentRequest extends EventTarget {
|
||||
onshippingoptionchange: (this: PaymentRequest, ev: Event) => any;
|
||||
readonly shippingAddress: PaymentAddress | null;
|
||||
readonly shippingOption: string | null;
|
||||
readonly shippingType: string | null;
|
||||
readonly shippingType: PaymentShippingType | null;
|
||||
abort(): Promise<void>;
|
||||
show(): Promise<PaymentResponse>;
|
||||
addEventListener<K extends keyof PaymentRequestEventMap>(type: K, listener: (this: PaymentRequest, ev: PaymentRequestEventMap[K]) => any, useCapture?: boolean): void;
|
||||
@@ -8612,7 +8622,7 @@ interface PaymentResponse {
|
||||
readonly payerPhone: string | null;
|
||||
readonly shippingAddress: PaymentAddress | null;
|
||||
readonly shippingOption: string | null;
|
||||
complete(result?: string): Promise<void>;
|
||||
complete(result?: PaymentComplete): Promise<void>;
|
||||
toJSON(): any;
|
||||
}
|
||||
|
||||
@@ -8740,7 +8750,7 @@ interface PerformanceNavigationTiming extends PerformanceEntry {
|
||||
readonly requestStart: number;
|
||||
readonly responseEnd: number;
|
||||
readonly responseStart: number;
|
||||
readonly type: string;
|
||||
readonly type: NavigationType;
|
||||
readonly unloadEventEnd: number;
|
||||
readonly unloadEventStart: number;
|
||||
}
|
||||
@@ -8809,7 +8819,7 @@ declare var PeriodicWave: {
|
||||
}
|
||||
|
||||
interface PermissionRequest extends DeferredPermissionRequest {
|
||||
readonly state: string;
|
||||
readonly state: MSWebViewPermissionState;
|
||||
defer(): void;
|
||||
}
|
||||
|
||||
@@ -8939,7 +8949,7 @@ declare var ProgressEvent: {
|
||||
|
||||
interface PushManager {
|
||||
getSubscription(): Promise<PushSubscription>;
|
||||
permissionState(options?: PushSubscriptionOptionsInit): Promise<string>;
|
||||
permissionState(options?: PushSubscriptionOptionsInit): Promise<PushPermissionState>;
|
||||
subscribe(options?: PushSubscriptionOptionsInit): Promise<PushSubscription>;
|
||||
}
|
||||
|
||||
@@ -8951,7 +8961,7 @@ declare var PushManager: {
|
||||
interface PushSubscription {
|
||||
readonly endpoint: USVString;
|
||||
readonly options: PushSubscriptionOptions;
|
||||
getKey(name: string): ArrayBuffer | null;
|
||||
getKey(name: PushEncryptionKeyName): ArrayBuffer | null;
|
||||
toJSON(): any;
|
||||
unsubscribe(): Promise<boolean>;
|
||||
}
|
||||
@@ -8988,7 +8998,7 @@ interface RTCDtlsTransportEventMap {
|
||||
interface RTCDtlsTransport extends RTCStatsProvider {
|
||||
ondtlsstatechange: ((this: RTCDtlsTransport, ev: RTCDtlsTransportStateChangedEvent) => any) | null;
|
||||
onerror: ((this: RTCDtlsTransport, ev: Event) => any) | null;
|
||||
readonly state: string;
|
||||
readonly state: RTCDtlsTransportState;
|
||||
readonly transport: RTCIceTransport;
|
||||
getLocalParameters(): RTCDtlsParameters;
|
||||
getRemoteCertificates(): ArrayBuffer[];
|
||||
@@ -9005,7 +9015,7 @@ declare var RTCDtlsTransport: {
|
||||
}
|
||||
|
||||
interface RTCDtlsTransportStateChangedEvent extends Event {
|
||||
readonly state: string;
|
||||
readonly state: RTCDtlsTransportState;
|
||||
}
|
||||
|
||||
declare var RTCDtlsTransportStateChangedEvent: {
|
||||
@@ -9061,7 +9071,7 @@ interface RTCIceGathererEventMap {
|
||||
}
|
||||
|
||||
interface RTCIceGatherer extends RTCStatsProvider {
|
||||
readonly component: string;
|
||||
readonly component: RTCIceComponent;
|
||||
onerror: ((this: RTCIceGatherer, ev: Event) => any) | null;
|
||||
onlocalcandidate: ((this: RTCIceGatherer, ev: RTCIceGathererEvent) => any) | null;
|
||||
createAssociatedGatherer(): RTCIceGatherer;
|
||||
@@ -9091,19 +9101,19 @@ interface RTCIceTransportEventMap {
|
||||
}
|
||||
|
||||
interface RTCIceTransport extends RTCStatsProvider {
|
||||
readonly component: string;
|
||||
readonly component: RTCIceComponent;
|
||||
readonly iceGatherer: RTCIceGatherer | null;
|
||||
oncandidatepairchange: ((this: RTCIceTransport, ev: RTCIceCandidatePairChangedEvent) => any) | null;
|
||||
onicestatechange: ((this: RTCIceTransport, ev: RTCIceTransportStateChangedEvent) => any) | null;
|
||||
readonly role: string;
|
||||
readonly state: string;
|
||||
readonly role: RTCIceRole;
|
||||
readonly state: RTCIceTransportState;
|
||||
addRemoteCandidate(remoteCandidate: RTCIceCandidateDictionary | RTCIceCandidateComplete): void;
|
||||
createAssociatedTransport(): RTCIceTransport;
|
||||
getNominatedCandidatePair(): RTCIceCandidatePair | null;
|
||||
getRemoteCandidates(): RTCIceCandidateDictionary[];
|
||||
getRemoteParameters(): RTCIceParameters | null;
|
||||
setRemoteCandidates(remoteCandidates: RTCIceCandidateDictionary[]): void;
|
||||
start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void;
|
||||
start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: RTCIceRole): void;
|
||||
stop(): void;
|
||||
addEventListener<K extends keyof RTCIceTransportEventMap>(type: K, listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
@@ -9115,7 +9125,7 @@ declare var RTCIceTransport: {
|
||||
}
|
||||
|
||||
interface RTCIceTransportStateChangedEvent extends Event {
|
||||
readonly state: string;
|
||||
readonly state: RTCIceTransportState;
|
||||
}
|
||||
|
||||
declare var RTCIceTransportStateChangedEvent: {
|
||||
@@ -9135,8 +9145,8 @@ interface RTCPeerConnectionEventMap {
|
||||
|
||||
interface RTCPeerConnection extends EventTarget {
|
||||
readonly canTrickleIceCandidates: boolean | null;
|
||||
readonly iceConnectionState: string;
|
||||
readonly iceGatheringState: string;
|
||||
readonly iceConnectionState: RTCIceConnectionState;
|
||||
readonly iceGatheringState: RTCIceGatheringState;
|
||||
readonly localDescription: RTCSessionDescription | null;
|
||||
onaddstream: (this: RTCPeerConnection, ev: MediaStreamEvent) => any;
|
||||
onicecandidate: (this: RTCPeerConnection, ev: RTCPeerConnectionIceEvent) => any;
|
||||
@@ -9146,7 +9156,7 @@ interface RTCPeerConnection extends EventTarget {
|
||||
onremovestream: (this: RTCPeerConnection, ev: MediaStreamEvent) => any;
|
||||
onsignalingstatechange: (this: RTCPeerConnection, ev: Event) => any;
|
||||
readonly remoteDescription: RTCSessionDescription | null;
|
||||
readonly signalingState: string;
|
||||
readonly signalingState: RTCSignalingState;
|
||||
addIceCandidate(candidate: RTCIceCandidate, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise<void>;
|
||||
addStream(stream: MediaStream): void;
|
||||
close(): void;
|
||||
@@ -9229,7 +9239,7 @@ declare var RTCRtpSender: {
|
||||
|
||||
interface RTCSessionDescription {
|
||||
sdp: string | null;
|
||||
type: string | null;
|
||||
type: RTCSdpType | null;
|
||||
toJSON(): any;
|
||||
}
|
||||
|
||||
@@ -9288,7 +9298,7 @@ interface Range {
|
||||
createContextualFragment(fragment: string): DocumentFragment;
|
||||
deleteContents(): void;
|
||||
detach(): void;
|
||||
expand(Unit: string): boolean;
|
||||
expand(Unit: ExpandGranularity): boolean;
|
||||
extractContents(): DocumentFragment;
|
||||
getBoundingClientRect(): ClientRect;
|
||||
getClientRects(): ClientRectList;
|
||||
@@ -9341,18 +9351,18 @@ declare var ReadableStreamReader: {
|
||||
}
|
||||
|
||||
interface Request extends Object, Body {
|
||||
readonly cache: string;
|
||||
readonly credentials: string;
|
||||
readonly destination: string;
|
||||
readonly cache: RequestCache;
|
||||
readonly credentials: RequestCredentials;
|
||||
readonly destination: RequestDestination;
|
||||
readonly headers: Headers;
|
||||
readonly integrity: string;
|
||||
readonly keepalive: boolean;
|
||||
readonly method: string;
|
||||
readonly mode: string;
|
||||
readonly redirect: string;
|
||||
readonly mode: RequestMode;
|
||||
readonly redirect: RequestRedirect;
|
||||
readonly referrer: string;
|
||||
readonly referrerPolicy: string;
|
||||
readonly type: string;
|
||||
readonly referrerPolicy: ReferrerPolicy;
|
||||
readonly type: RequestType;
|
||||
readonly url: string;
|
||||
clone(): Request;
|
||||
}
|
||||
@@ -9368,7 +9378,7 @@ interface Response extends Object, Body {
|
||||
readonly ok: boolean;
|
||||
readonly status: number;
|
||||
readonly statusText: string;
|
||||
readonly type: string;
|
||||
readonly type: ResponseType;
|
||||
readonly url: string;
|
||||
clone(): Response;
|
||||
}
|
||||
@@ -11168,7 +11178,7 @@ declare var SVGZoomEvent: {
|
||||
|
||||
interface ScopedCredential {
|
||||
readonly id: ArrayBuffer;
|
||||
readonly type: string;
|
||||
readonly type: ScopedCredentialType;
|
||||
}
|
||||
|
||||
declare var ScopedCredential: {
|
||||
@@ -11285,7 +11295,7 @@ interface ServiceWorkerEventMap extends AbstractWorkerEventMap {
|
||||
interface ServiceWorker extends EventTarget, AbstractWorker {
|
||||
onstatechange: (this: ServiceWorker, ev: Event) => any;
|
||||
readonly scriptURL: USVString;
|
||||
readonly state: string;
|
||||
readonly state: ServiceWorkerState;
|
||||
postMessage(message: any, transfer?: any[]): void;
|
||||
addEventListener<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
@@ -11361,7 +11371,7 @@ interface SourceBuffer extends EventTarget {
|
||||
appendWindowStart: number;
|
||||
readonly audioTracks: AudioTrackList;
|
||||
readonly buffered: TimeRanges;
|
||||
mode: string;
|
||||
mode: AppendMode;
|
||||
timestampOffset: number;
|
||||
readonly updating: boolean;
|
||||
readonly videoTracks: VideoTrackList;
|
||||
@@ -11597,7 +11607,7 @@ interface Text extends CharacterData {
|
||||
|
||||
declare var Text: {
|
||||
prototype: Text;
|
||||
new(): Text;
|
||||
new(data?: string): Text;
|
||||
}
|
||||
|
||||
interface TextEvent extends UIEvent {
|
||||
@@ -11780,7 +11790,7 @@ interface TouchEvent extends UIEvent {
|
||||
|
||||
declare var TouchEvent: {
|
||||
prototype: TouchEvent;
|
||||
new(): TouchEvent;
|
||||
new(type: string, touchEventInit?: TouchEventInit): TouchEvent;
|
||||
}
|
||||
|
||||
interface TouchList {
|
||||
@@ -11857,7 +11867,7 @@ interface URL {
|
||||
protocol: string;
|
||||
search: string;
|
||||
username: string;
|
||||
readonly searchparams: URLSearchParams;
|
||||
readonly searchParams: URLSearchParams;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
@@ -11986,7 +11996,7 @@ declare var WEBGL_depth_texture: {
|
||||
|
||||
interface WaveShaperNode extends AudioNode {
|
||||
curve: Float32Array | null;
|
||||
oversample: string;
|
||||
oversample: OverSampleType;
|
||||
}
|
||||
|
||||
declare var WaveShaperNode: {
|
||||
@@ -12181,12 +12191,12 @@ interface WebGLRenderingContext {
|
||||
stencilMaskSeparate(face: number, mask: number): void;
|
||||
stencilOp(fail: number, zfail: number, zpass: number): void;
|
||||
stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels: ArrayBufferView | null): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;
|
||||
texParameterf(target: number, pname: number, param: number): void;
|
||||
texParameteri(target: number, pname: number, param: number): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;
|
||||
uniform1f(location: WebGLUniformLocation | null, x: number): void;
|
||||
uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;
|
||||
uniform1i(location: WebGLUniformLocation | null, x: number): void;
|
||||
@@ -13247,6 +13257,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
readonly top: Window;
|
||||
readonly window: Window;
|
||||
URL: typeof URL;
|
||||
URLSearchParams: typeof URLSearchParams;
|
||||
Blob: typeof Blob;
|
||||
customElements: CustomElementRegistry;
|
||||
alert(message?: any): void;
|
||||
@@ -13255,7 +13266,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
captureEvents(): void;
|
||||
close(): void;
|
||||
confirm(message?: string): boolean;
|
||||
departFocus(navigationReason: string, origin: FocusNavigationOrigin): void;
|
||||
departFocus(navigationReason: NavigationReason, origin: FocusNavigationOrigin): void;
|
||||
focus(): void;
|
||||
getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;
|
||||
getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList;
|
||||
@@ -13280,6 +13291,8 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;
|
||||
webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;
|
||||
webkitRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, options?: ImageBitmapOptions): Promise<ImageBitmap>;
|
||||
createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise<ImageBitmap>;
|
||||
scroll(options?: ScrollToOptions): void;
|
||||
scrollTo(options?: ScrollToOptions): void;
|
||||
scrollBy(options?: ScrollToOptions): void;
|
||||
@@ -13328,7 +13341,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
readonly readyState: number;
|
||||
readonly response: any;
|
||||
readonly responseText: string;
|
||||
responseType: string;
|
||||
responseType: XMLHttpRequestResponseType;
|
||||
readonly responseURL: string;
|
||||
readonly responseXML: Document | null;
|
||||
readonly status: number;
|
||||
@@ -13493,6 +13506,7 @@ interface Body {
|
||||
blob(): Promise<Blob>;
|
||||
json(): Promise<any>;
|
||||
text(): Promise<string>;
|
||||
formData(): Promise<FormData>;
|
||||
}
|
||||
|
||||
interface CanvasPathMethods {
|
||||
@@ -13855,6 +13869,21 @@ interface Canvas2DContextAttributes {
|
||||
[attribute: string]: boolean | string | undefined;
|
||||
}
|
||||
|
||||
interface ImageBitmapOptions {
|
||||
imageOrientation?: "none" | "flipY";
|
||||
premultiplyAlpha?: "none" | "premultiply" | "default";
|
||||
colorSpaceConversion?: "none" | "default";
|
||||
resizeWidth?: number;
|
||||
resizeHeight?: number;
|
||||
resizeQuality?: "pixelated" | "low" | "medium" | "high";
|
||||
}
|
||||
|
||||
interface ImageBitmap {
|
||||
readonly width: number;
|
||||
readonly height: number;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
interface URLSearchParams {
|
||||
/**
|
||||
* Appends a specified key/value pair as a new search parameter.
|
||||
@@ -13899,6 +13928,7 @@ interface NodeListOf<TNode extends Node> extends NodeList {
|
||||
interface HTMLCollectionOf<T extends Element> extends HTMLCollection {
|
||||
item(index: number): T;
|
||||
namedItem(name: string): T;
|
||||
[index: number]: T;
|
||||
}
|
||||
|
||||
interface BlobPropertyBag {
|
||||
@@ -14168,6 +14198,21 @@ interface PromiseRejectionEventInit extends EventInit {
|
||||
reason?: any;
|
||||
}
|
||||
|
||||
interface EventListenerOptions {
|
||||
capture?: boolean;
|
||||
}
|
||||
|
||||
interface AddEventListenerOptions extends EventListenerOptions {
|
||||
passive?: boolean;
|
||||
once?: boolean;
|
||||
}
|
||||
|
||||
interface TouchEventInit extends EventModifierInit {
|
||||
touches?: Touch[];
|
||||
targetTouches?: Touch[];
|
||||
changedTouches?: Touch[];
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
@@ -14225,10 +14270,10 @@ interface NavigatorUserMediaErrorCallback {
|
||||
(error: MediaStreamError): void;
|
||||
}
|
||||
interface ForEachCallback {
|
||||
(keyId: any, status: string): void;
|
||||
(keyId: any, status: MediaKeyStatus): void;
|
||||
}
|
||||
interface NotificationPermissionCallback {
|
||||
(permission: string): void;
|
||||
(permission: NotificationPermission): void;
|
||||
}
|
||||
interface IntersectionObserverCallback {
|
||||
(entries: IntersectionObserverEntry[], observer: IntersectionObserver): void;
|
||||
@@ -14835,7 +14880,7 @@ declare function cancelAnimationFrame(handle: number): void;
|
||||
declare function captureEvents(): void;
|
||||
declare function close(): void;
|
||||
declare function confirm(message?: string): boolean;
|
||||
declare function departFocus(navigationReason: string, origin: FocusNavigationOrigin): void;
|
||||
declare function departFocus(navigationReason: NavigationReason, origin: FocusNavigationOrigin): void;
|
||||
declare function focus(): void;
|
||||
declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;
|
||||
declare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList;
|
||||
@@ -14860,12 +14905,14 @@ declare function webkitCancelAnimationFrame(handle: number): void;
|
||||
declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;
|
||||
declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;
|
||||
declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
declare function createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, options?: ImageBitmapOptions): Promise<ImageBitmap>;
|
||||
declare function createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise<ImageBitmap>;
|
||||
declare function scroll(options?: ScrollToOptions): void;
|
||||
declare function scrollTo(options?: ScrollToOptions): void;
|
||||
declare function scrollBy(options?: ScrollToOptions): void;
|
||||
declare function toString(): string;
|
||||
declare function dispatchEvent(evt: Event): boolean;
|
||||
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
||||
declare function clearInterval(handle: number): void;
|
||||
declare function clearTimeout(handle: number): void;
|
||||
declare function setInterval(handler: (...args: any[]) => void, timeout: number): number;
|
||||
@@ -14934,4 +14981,76 @@ type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
|
||||
type IDBValidKey = number | string | Date | IDBArrayKey;
|
||||
type BufferSource = ArrayBuffer | ArrayBufferView;
|
||||
type MouseWheelEvent = WheelEvent;
|
||||
type ScrollRestoration = "auto" | "manual";
|
||||
type ScrollRestoration = "auto" | "manual";
|
||||
type FormDataEntryValue = string | File;
|
||||
type AppendMode = "segments" | "sequence";
|
||||
type AudioContextState = "suspended" | "running" | "closed";
|
||||
type BiquadFilterType = "lowpass" | "highpass" | "bandpass" | "lowshelf" | "highshelf" | "peaking" | "notch" | "allpass";
|
||||
type CanvasFillRule = "nonzero" | "evenodd";
|
||||
type ChannelCountMode = "max" | "clamped-max" | "explicit";
|
||||
type ChannelInterpretation = "speakers" | "discrete";
|
||||
type DistanceModelType = "linear" | "inverse" | "exponential";
|
||||
type ExpandGranularity = "character" | "word" | "sentence" | "textedit";
|
||||
type GamepadInputEmulationType = "mouse" | "keyboard" | "gamepad";
|
||||
type IDBCursorDirection = "next" | "nextunique" | "prev" | "prevunique";
|
||||
type IDBRequestReadyState = "pending" | "done";
|
||||
type IDBTransactionMode = "readonly" | "readwrite" | "versionchange";
|
||||
type ListeningState = "inactive" | "active" | "disambiguation";
|
||||
type MSCredentialType = "FIDO_2_0";
|
||||
type MSIceAddrType = "os" | "stun" | "turn" | "peer-derived";
|
||||
type MSIceType = "failed" | "direct" | "relay";
|
||||
type MSStatsType = "description" | "localclientevent" | "inbound-network" | "outbound-network" | "inbound-payload" | "outbound-payload" | "transportdiagnostics";
|
||||
type MSTransportType = "Embedded" | "USB" | "NFC" | "BT";
|
||||
type MSWebViewPermissionState = "unknown" | "defer" | "allow" | "deny";
|
||||
type MSWebViewPermissionType = "geolocation" | "unlimitedIndexedDBQuota" | "media" | "pointerlock" | "webnotifications";
|
||||
type MediaDeviceKind = "audioinput" | "audiooutput" | "videoinput";
|
||||
type MediaKeyMessageType = "license-request" | "license-renewal" | "license-release" | "individualization-request";
|
||||
type MediaKeySessionType = "temporary" | "persistent-license" | "persistent-release-message";
|
||||
type MediaKeyStatus = "usable" | "expired" | "output-downscaled" | "output-not-allowed" | "status-pending" | "internal-error";
|
||||
type MediaKeysRequirement = "required" | "optional" | "not-allowed";
|
||||
type MediaStreamTrackState = "live" | "ended";
|
||||
type NavigationReason = "up" | "down" | "left" | "right";
|
||||
type NavigationType = "navigate" | "reload" | "back_forward" | "prerender";
|
||||
type NotificationDirection = "auto" | "ltr" | "rtl";
|
||||
type NotificationPermission = "default" | "denied" | "granted";
|
||||
type OscillatorType = "sine" | "square" | "sawtooth" | "triangle" | "custom";
|
||||
type OverSampleType = "none" | "2x" | "4x";
|
||||
type PanningModelType = "equalpower";
|
||||
type PaymentComplete = "success" | "fail" | "";
|
||||
type PaymentShippingType = "shipping" | "delivery" | "pickup";
|
||||
type PushEncryptionKeyName = "p256dh" | "auth";
|
||||
type PushPermissionState = "granted" | "denied" | "prompt";
|
||||
type RTCBundlePolicy = "balanced" | "max-compat" | "max-bundle";
|
||||
type RTCDegradationPreference = "maintain-framerate" | "maintain-resolution" | "balanced";
|
||||
type RTCDtlsRole = "auto" | "client" | "server";
|
||||
type RTCDtlsTransportState = "new" | "connecting" | "connected" | "closed";
|
||||
type RTCIceCandidateType = "host" | "srflx" | "prflx" | "relay";
|
||||
type RTCIceComponent = "RTP" | "RTCP";
|
||||
type RTCIceConnectionState = "new" | "checking" | "connected" | "completed" | "failed" | "disconnected" | "closed";
|
||||
type RTCIceGatherPolicy = "all" | "nohost" | "relay";
|
||||
type RTCIceGathererState = "new" | "gathering" | "complete";
|
||||
type RTCIceGatheringState = "new" | "gathering" | "complete";
|
||||
type RTCIceProtocol = "udp" | "tcp";
|
||||
type RTCIceRole = "controlling" | "controlled";
|
||||
type RTCIceTcpCandidateType = "active" | "passive" | "so";
|
||||
type RTCIceTransportPolicy = "none" | "relay" | "all";
|
||||
type RTCIceTransportState = "new" | "checking" | "connected" | "completed" | "disconnected" | "closed";
|
||||
type RTCSdpType = "offer" | "pranswer" | "answer";
|
||||
type RTCSignalingState = "stable" | "have-local-offer" | "have-remote-offer" | "have-local-pranswer" | "have-remote-pranswer" | "closed";
|
||||
type RTCStatsIceCandidatePairState = "frozen" | "waiting" | "inprogress" | "failed" | "succeeded" | "cancelled";
|
||||
type RTCStatsIceCandidateType = "host" | "serverreflexive" | "peerreflexive" | "relayed";
|
||||
type RTCStatsType = "inboundrtp" | "outboundrtp" | "session" | "datachannel" | "track" | "transport" | "candidatepair" | "localcandidate" | "remotecandidate";
|
||||
type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin-only" | "origin-when-cross-origin" | "unsafe-url";
|
||||
type RequestCache = "default" | "no-store" | "reload" | "no-cache" | "force-cache";
|
||||
type RequestCredentials = "omit" | "same-origin" | "include";
|
||||
type RequestDestination = "" | "document" | "sharedworker" | "subresource" | "unknown" | "worker";
|
||||
type RequestMode = "navigate" | "same-origin" | "no-cors" | "cors";
|
||||
type RequestRedirect = "follow" | "error" | "manual";
|
||||
type RequestType = "" | "audio" | "font" | "image" | "script" | "style" | "track" | "video";
|
||||
type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect";
|
||||
type ScopedCredentialType = "ScopedCred";
|
||||
type ServiceWorkerState = "installing" | "installed" | "activating" | "activated" | "redundant";
|
||||
type Transport = "usb" | "nfc" | "ble";
|
||||
type VideoFacingModeEnum = "user" | "environment" | "left" | "right";
|
||||
type VisibilityState = "hidden" | "visible" | "prerender" | "unloaded";
|
||||
type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text";
|
||||
Vendored
+96
-2
@@ -24,10 +24,104 @@ interface DOMTokenList {
|
||||
[Symbol.iterator](): IterableIterator<string>;
|
||||
}
|
||||
|
||||
interface FormData {
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the list
|
||||
*/
|
||||
entries(): IterableIterator<[string, string | File]>;
|
||||
/**
|
||||
* Returns a list of keys in the list
|
||||
*/
|
||||
keys(): IterableIterator<string>;
|
||||
/**
|
||||
* Returns a list of values in the list
|
||||
*/
|
||||
values(): IterableIterator<string | File>;
|
||||
|
||||
[Symbol.iterator](): IterableIterator<string | File>;
|
||||
}
|
||||
|
||||
interface Headers {
|
||||
[Symbol.iterator](): IterableIterator<[string, string]>;
|
||||
/**
|
||||
* Returns an iterator allowing to go through all key/value pairs contained in this object.
|
||||
*/
|
||||
entries(): IterableIterator<[string, string]>;
|
||||
/**
|
||||
* Returns an iterator allowing to go through all keys f the key/value pairs contained in this object.
|
||||
*/
|
||||
keys(): IterableIterator<string>;
|
||||
/**
|
||||
* Returns an iterator allowing to go through all values of the key/value pairs contained in this object.
|
||||
*/
|
||||
values(): IterableIterator<string>;
|
||||
}
|
||||
|
||||
interface NodeList {
|
||||
[Symbol.iterator](): IterableIterator<Node>
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the list
|
||||
*/
|
||||
entries(): IterableIterator<[number, Node]>;
|
||||
/**
|
||||
* Performs the specified action for each node in an list.
|
||||
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the list.
|
||||
* @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.
|
||||
*/
|
||||
forEach(callbackfn: (value: Node, index: number, listObj: NodeList) => void, thisArg?: any): void;
|
||||
/**
|
||||
* Returns an list of keys in the list
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns an list of values in the list
|
||||
*/
|
||||
values(): IterableIterator<Node>;
|
||||
|
||||
|
||||
[Symbol.iterator](): IterableIterator<Node>;
|
||||
}
|
||||
|
||||
interface NodeListOf<TNode extends Node> {
|
||||
[Symbol.iterator](): IterableIterator<TNode>
|
||||
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the list
|
||||
*/
|
||||
entries(): IterableIterator<[number, TNode]>;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each node in an list.
|
||||
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the list.
|
||||
* @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.
|
||||
*/
|
||||
forEach(callbackfn: (value: TNode, index: number, listObj: NodeListOf<TNode>) => void, thisArg?: any): void;
|
||||
/**
|
||||
* Returns an list of keys in the list
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an list of values in the list
|
||||
*/
|
||||
values(): IterableIterator<TNode>;
|
||||
|
||||
[Symbol.iterator](): IterableIterator<TNode>;
|
||||
}
|
||||
|
||||
interface URLSearchParams {
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the search params
|
||||
*/
|
||||
entries(): IterableIterator<[string, string]>;
|
||||
/**
|
||||
* Returns a list of keys in the search params
|
||||
*/
|
||||
keys(): IterableIterator<string>;
|
||||
/**
|
||||
* Returns a list of values in the search params
|
||||
*/
|
||||
values(): IterableIterator<string>;
|
||||
/**
|
||||
* iterate over key/value pairs
|
||||
*/
|
||||
[Symbol.iterator](): IterableIterator<[string, string]>;
|
||||
}
|
||||
|
||||
Vendored
+6
-6
@@ -37,7 +37,7 @@ declare var Map: MapConstructor;
|
||||
|
||||
interface ReadonlyMap<K, V> {
|
||||
forEach(callbackfn: (value: V, key: K, map: ReadonlyMap<K, V>) => void, thisArg?: any): void;
|
||||
get(key: K): V|undefined;
|
||||
get(key: K): V | undefined;
|
||||
has(key: K): boolean;
|
||||
readonly size: number;
|
||||
}
|
||||
@@ -50,9 +50,9 @@ interface WeakMap<K extends object, V> {
|
||||
}
|
||||
|
||||
interface WeakMapConstructor {
|
||||
new (): WeakMap<any, any>;
|
||||
new (): WeakMap<object, any>;
|
||||
new <K extends object, V>(entries?: [K, V][]): WeakMap<K, V>;
|
||||
readonly prototype: WeakMap<any, any>;
|
||||
readonly prototype: WeakMap<object, any>;
|
||||
}
|
||||
declare var WeakMap: WeakMapConstructor;
|
||||
|
||||
@@ -85,8 +85,8 @@ interface WeakSet<T> {
|
||||
}
|
||||
|
||||
interface WeakSetConstructor {
|
||||
new (): WeakSet<any>;
|
||||
new <T>(values?: T[]): WeakSet<T>;
|
||||
readonly prototype: WeakSet<any>;
|
||||
new (): WeakSet<object>;
|
||||
new <T extends object>(values?: T[]): WeakSet<T>;
|
||||
readonly prototype: WeakSet<object>;
|
||||
}
|
||||
declare var WeakSet: WeakSetConstructor;
|
||||
|
||||
Vendored
+293
-283
@@ -22,69 +22,75 @@ declare type PropertyKey = string | number | symbol;
|
||||
|
||||
interface Array<T> {
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @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.
|
||||
*/
|
||||
find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T | undefined;
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @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.
|
||||
*/
|
||||
find(predicate: (this: void, value: T, index: number, obj: Array<T>) => boolean): T | undefined;
|
||||
find(predicate: (this: void, value: T, index: number, obj: Array<T>) => boolean, thisArg: undefined): T | undefined;
|
||||
find<Z>(predicate: (this: Z, value: T, index: number, obj: Array<T>) => boolean, thisArg: Z): T | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and -1
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found,
|
||||
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
|
||||
* @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: Array<T>) => boolean, thisArg?: any): number;
|
||||
* Returns the index of the first element in the array where predicate is true, and -1
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found,
|
||||
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
|
||||
* @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: (this: void, value: T, index: number, obj: Array<T>) => boolean): number;
|
||||
findIndex(predicate: (this: void, value: T, index: number, obj: Array<T>) => boolean, thisArg: undefined): number;
|
||||
findIndex<Z>(predicate: (this: Z, value: T, index: number, obj: Array<T>) => boolean, thisArg: Z): number;
|
||||
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
fill(value: T, start?: number, end?: number): this;
|
||||
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
copyWithin(target: number, start: number, end?: number): this;
|
||||
}
|
||||
|
||||
interface ArrayConstructor {
|
||||
/**
|
||||
* Creates an array from an array-like object.
|
||||
* @param arrayLike An array-like object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): Array<U>;
|
||||
* Creates an array from an array-like object.
|
||||
* @param arrayLike An array-like object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (this: void, v: T, k: number) => U): Array<U>;
|
||||
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (this: void, v: T, k: number) => U, thisArg: undefined): Array<U>;
|
||||
from<Z, T, U>(arrayLike: ArrayLike<T>, mapfn: (this: Z, v: T, k: number) => U, thisArg: Z): Array<U>;
|
||||
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like object.
|
||||
* @param arrayLike An array-like object to convert to an array.
|
||||
*/
|
||||
* Creates an array from an array-like object.
|
||||
* @param arrayLike An array-like object to convert to an array.
|
||||
*/
|
||||
from<T>(arrayLike: ArrayLike<T>): Array<T>;
|
||||
|
||||
/**
|
||||
* Returns a new array from a set of elements.
|
||||
* @param items A set of elements to include in the new array object.
|
||||
*/
|
||||
* Returns a new array from a set of elements.
|
||||
* @param items A set of elements to include in the new array object.
|
||||
*/
|
||||
of<T>(...items: T[]): Array<T>;
|
||||
}
|
||||
|
||||
@@ -94,328 +100,332 @@ interface DateConstructor {
|
||||
|
||||
interface Function {
|
||||
/**
|
||||
* Returns the name of the function. Function names are read-only and can not be changed.
|
||||
*/
|
||||
* Returns the name of the function. Function names are read-only and can not be changed.
|
||||
*/
|
||||
readonly name: string;
|
||||
}
|
||||
|
||||
interface Math {
|
||||
/**
|
||||
* Returns the number of leading zero bits in the 32-bit binary representation of a number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
* Returns the number of leading zero bits in the 32-bit binary representation of a number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
clz32(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the result of 32-bit multiplication of two numbers.
|
||||
* @param x First number
|
||||
* @param y Second number
|
||||
*/
|
||||
* Returns the result of 32-bit multiplication of two numbers.
|
||||
* @param x First number
|
||||
* @param y Second number
|
||||
*/
|
||||
imul(x: number, y: number): number;
|
||||
|
||||
/**
|
||||
* Returns the sign of the x, indicating whether x is positive, negative or zero.
|
||||
* @param x The numeric expression to test
|
||||
*/
|
||||
* Returns the sign of the x, indicating whether x is positive, negative or zero.
|
||||
* @param x The numeric expression to test
|
||||
*/
|
||||
sign(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the base 10 logarithm of a number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
* Returns the base 10 logarithm of a number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
log10(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the base 2 logarithm of a number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
* Returns the base 2 logarithm of a number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
log2(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the natural logarithm of 1 + x.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
* Returns the natural logarithm of 1 + x.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
log1p(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of
|
||||
* the natural logarithms).
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
* Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of
|
||||
* the natural logarithms).
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
expm1(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the hyperbolic cosine of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
* Returns the hyperbolic cosine of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
cosh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the hyperbolic sine of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
* Returns the hyperbolic sine of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
sinh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the hyperbolic tangent of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
* Returns the hyperbolic tangent of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
tanh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the inverse hyperbolic cosine of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
* Returns the inverse hyperbolic cosine of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
acosh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the inverse hyperbolic sine of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
* Returns the inverse hyperbolic sine of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
asinh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the inverse hyperbolic tangent of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
* Returns the inverse hyperbolic tangent of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
atanh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the square root of the sum of squares of its arguments.
|
||||
* @param values Values to compute the square root for.
|
||||
* If no arguments are passed, the result is +0.
|
||||
* If there is only one argument, the result is the absolute value.
|
||||
* If any argument is +Infinity or -Infinity, the result is +Infinity.
|
||||
* If any argument is NaN, the result is NaN.
|
||||
* If all arguments are either +0 or −0, the result is +0.
|
||||
*/
|
||||
* Returns the square root of the sum of squares of its arguments.
|
||||
* @param values Values to compute the square root for.
|
||||
* If no arguments are passed, the result is +0.
|
||||
* If there is only one argument, the result is the absolute value.
|
||||
* If any argument is +Infinity or -Infinity, the result is +Infinity.
|
||||
* If any argument is NaN, the result is NaN.
|
||||
* If all arguments are either +0 or −0, the result is +0.
|
||||
*/
|
||||
hypot(...values: number[] ): number;
|
||||
|
||||
/**
|
||||
* Returns the integral part of the a numeric expression, x, removing any fractional digits.
|
||||
* If x is already an integer, the result is x.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
* Returns the integral part of the a numeric expression, x, removing any fractional digits.
|
||||
* If x is already an integer, the result is x.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
trunc(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the nearest single precision float representation of a number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
* Returns the nearest single precision float representation of a number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
fround(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns an implementation-dependent approximation to the cube root of number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
* Returns an implementation-dependent approximation to the cube root of number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
cbrt(x: number): number;
|
||||
}
|
||||
|
||||
interface NumberConstructor {
|
||||
/**
|
||||
* The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1
|
||||
* that is representable as a Number value, which is approximately:
|
||||
* 2.2204460492503130808472633361816 x 10−16.
|
||||
*/
|
||||
* The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1
|
||||
* that is representable as a Number value, which is approximately:
|
||||
* 2.2204460492503130808472633361816 x 10−16.
|
||||
*/
|
||||
readonly EPSILON: number;
|
||||
|
||||
/**
|
||||
* Returns true if passed value is finite.
|
||||
* Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a
|
||||
* number. Only finite values of the type number, result in true.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
* Returns true if passed value is finite.
|
||||
* Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a
|
||||
* number. Only finite values of the type number, result in true.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
isFinite(number: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the value passed is an integer, false otherwise.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
* Returns true if the value passed is an integer, false otherwise.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
isInteger(number: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
|
||||
* number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter
|
||||
* to a number. Only values of the type number, that are also NaN, result in true.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
|
||||
* number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter
|
||||
* to a number. Only values of the type number, that are also NaN, result in true.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
isNaN(number: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the value passed is a safe integer.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
* Returns true if the value passed is a safe integer.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
isSafeInteger(number: number): boolean;
|
||||
|
||||
/**
|
||||
* The value of the largest integer n such that n and n + 1 are both exactly representable as
|
||||
* a Number value.
|
||||
* The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1.
|
||||
*/
|
||||
* The value of the largest integer n such that n and n + 1 are both exactly representable as
|
||||
* a Number value.
|
||||
* The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1.
|
||||
*/
|
||||
readonly MAX_SAFE_INTEGER: number;
|
||||
|
||||
/**
|
||||
* The value of the smallest integer n such that n and n − 1 are both exactly representable as
|
||||
* a Number value.
|
||||
* The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)).
|
||||
*/
|
||||
* The value of the smallest integer n such that n and n − 1 are both exactly representable as
|
||||
* a Number value.
|
||||
* The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)).
|
||||
*/
|
||||
readonly MIN_SAFE_INTEGER: number;
|
||||
|
||||
/**
|
||||
* Converts a string to a floating-point number.
|
||||
* @param string A string that contains a floating-point number.
|
||||
*/
|
||||
* Converts a string to a floating-point number.
|
||||
* @param string A string that contains a floating-point number.
|
||||
*/
|
||||
parseFloat(string: string): number;
|
||||
|
||||
/**
|
||||
* Converts A string to an integer.
|
||||
* @param s A string to convert into a number.
|
||||
* @param radix A value between 2 and 36 that specifies the base of the number in numString.
|
||||
* If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
|
||||
* All other strings are considered decimal.
|
||||
*/
|
||||
* Converts A string to an integer.
|
||||
* @param s A string to convert into a number.
|
||||
* @param radix A value between 2 and 36 that specifies the base of the number in numString.
|
||||
* If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
|
||||
* All other strings are considered decimal.
|
||||
*/
|
||||
parseInt(string: string, radix?: number): number;
|
||||
}
|
||||
|
||||
interface Object {
|
||||
/**
|
||||
* Determines whether an object has a property with the specified name.
|
||||
* @param v A property name.
|
||||
*/
|
||||
hasOwnProperty(v: PropertyKey): boolean
|
||||
* Determines whether an object has a property with the specified name.
|
||||
* @param v A property name.
|
||||
*/
|
||||
hasOwnProperty(v: PropertyKey): boolean;
|
||||
|
||||
/**
|
||||
* Determines whether a specified property is enumerable.
|
||||
* @param v A property name.
|
||||
*/
|
||||
* Determines whether a specified property is enumerable.
|
||||
* @param v A property name.
|
||||
*/
|
||||
propertyIsEnumerable(v: PropertyKey): boolean;
|
||||
}
|
||||
|
||||
interface ObjectConstructor {
|
||||
/**
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* target object. Returns the target object.
|
||||
* @param target The target object to copy to.
|
||||
* @param source The source object from which to copy properties.
|
||||
*/
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* target object. Returns the target object.
|
||||
* @param target The target object to copy to.
|
||||
* @param source The source object from which to copy properties.
|
||||
*/
|
||||
assign<T, U>(target: T, source: U): T & U;
|
||||
|
||||
/**
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* target object. Returns the target object.
|
||||
* @param target The target object to copy to.
|
||||
* @param source1 The first source object from which to copy properties.
|
||||
* @param source2 The second source object from which to copy properties.
|
||||
*/
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* target object. Returns the target object.
|
||||
* @param target The target object to copy to.
|
||||
* @param source1 The first source object from which to copy properties.
|
||||
* @param source2 The second source object from which to copy properties.
|
||||
*/
|
||||
assign<T, U, V>(target: T, source1: U, source2: V): T & U & V;
|
||||
|
||||
/**
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* target object. Returns the target object.
|
||||
* @param target The target object to copy to.
|
||||
* @param source1 The first source object from which to copy properties.
|
||||
* @param source2 The second source object from which to copy properties.
|
||||
* @param source3 The third source object from which to copy properties.
|
||||
*/
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* target object. Returns the target object.
|
||||
* @param target The target object to copy to.
|
||||
* @param source1 The first source object from which to copy properties.
|
||||
* @param source2 The second source object from which to copy properties.
|
||||
* @param source3 The third source object from which to copy properties.
|
||||
*/
|
||||
assign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
|
||||
|
||||
/**
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* target object. Returns the target object.
|
||||
* @param target The target object to copy to.
|
||||
* @param sources One or more source objects from which to copy properties
|
||||
*/
|
||||
assign(target: any, ...sources: any[]): any;
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* target object. Returns the target object.
|
||||
* @param target The target object to copy to.
|
||||
* @param sources One or more source objects from which to copy properties
|
||||
*/
|
||||
assign(target: object, ...sources: any[]): any;
|
||||
|
||||
/**
|
||||
* Returns an array of all symbol properties found directly on object o.
|
||||
* @param o Object to retrieve the symbols from.
|
||||
*/
|
||||
* Returns an array of all symbol properties found directly on object o.
|
||||
* @param o Object to retrieve the symbols from.
|
||||
*/
|
||||
getOwnPropertySymbols(o: any): symbol[];
|
||||
|
||||
/**
|
||||
* Returns true if the values are the same value, false otherwise.
|
||||
* @param value1 The first value.
|
||||
* @param value2 The second value.
|
||||
*/
|
||||
* Returns true if the values are the same value, false otherwise.
|
||||
* @param value1 The first value.
|
||||
* @param value2 The second value.
|
||||
*/
|
||||
is(value1: any, value2: any): boolean;
|
||||
|
||||
/**
|
||||
* Sets the prototype of a specified object o to object proto or null. Returns the object o.
|
||||
* @param o The object to change its prototype.
|
||||
* @param proto The value of the new prototype or null.
|
||||
*/
|
||||
* Sets the prototype of a specified object o to object proto or null. Returns the object o.
|
||||
* @param o The object to change its prototype.
|
||||
* @param proto The value of the new prototype or null.
|
||||
*/
|
||||
setPrototypeOf(o: any, proto: object | null): any;
|
||||
|
||||
/**
|
||||
* Gets the own property descriptor of the specified object.
|
||||
* An own property descriptor is one that is defined directly on the object and is not
|
||||
* inherited from the object's prototype.
|
||||
* @param o Object that contains the property.
|
||||
* @param p Name of the property.
|
||||
*/
|
||||
* Gets the own property descriptor of the specified object.
|
||||
* An own property descriptor is one that is defined directly on the object and is not
|
||||
* inherited from the object's prototype.
|
||||
* @param o Object that contains the property.
|
||||
* @param p Name of the property.
|
||||
*/
|
||||
getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor;
|
||||
|
||||
/**
|
||||
* Adds a property to an object, or modifies attributes of an existing property.
|
||||
* @param o Object on which to add or modify the property. This can be a native JavaScript
|
||||
* object (that is, a user-defined object or a built in object) or a DOM object.
|
||||
* @param p The property name.
|
||||
* @param attributes Descriptor for the property. It can be for a data property or an accessor
|
||||
* property.
|
||||
*/
|
||||
* Adds a property to an object, or modifies attributes of an existing property.
|
||||
* @param o Object on which to add or modify the property. This can be a native JavaScript
|
||||
* object (that is, a user-defined object or a built in object) or a DOM object.
|
||||
* @param p The property name.
|
||||
* @param attributes Descriptor for the property. It can be for a data property or an accessor
|
||||
* property.
|
||||
*/
|
||||
defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any;
|
||||
}
|
||||
|
||||
interface ReadonlyArray<T> {
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @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.
|
||||
*/
|
||||
find(predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean, thisArg?: any): T | undefined;
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @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.
|
||||
*/
|
||||
find(predicate: (this: void, value: T, index: number, obj: ReadonlyArray<T>) => boolean): T | undefined;
|
||||
find(predicate: (this: void, value: T, index: number, obj: ReadonlyArray<T>) => boolean, thisArg: undefined): T | undefined;
|
||||
find<Z>(predicate: (this: Z, value: T, index: number, obj: ReadonlyArray<T>) => boolean, thisArg: Z): T | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and -1
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found,
|
||||
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
|
||||
* @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: Array<T>) => boolean, thisArg?: any): number;
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and -1
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found,
|
||||
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
|
||||
* @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: (this: void, value: T, index: number, obj: Array<T>) => boolean): number;
|
||||
findIndex(predicate: (this: void, value: T, index: number, obj: Array<T>) => boolean, thisArg: undefined): number;
|
||||
findIndex<Z>(predicate: (this: Z, value: T, index: number, obj: Array<T>) => boolean, thisArg: Z): number;
|
||||
}
|
||||
|
||||
interface RegExp {
|
||||
/**
|
||||
* Returns a string indicating the flags of the regular expression in question. This field is read-only.
|
||||
* The characters in this string are sequenced and concatenated in the following order:
|
||||
*
|
||||
* - "g" for global
|
||||
* - "i" for ignoreCase
|
||||
* - "m" for multiline
|
||||
* - "u" for unicode
|
||||
* - "y" for sticky
|
||||
*
|
||||
* If no flags are set, the value is the empty string.
|
||||
*/
|
||||
* Returns a string indicating the flags of the regular expression in question. This field is read-only.
|
||||
* The characters in this string are sequenced and concatenated in the following order:
|
||||
*
|
||||
* - "g" for global
|
||||
* - "i" for ignoreCase
|
||||
* - "m" for multiline
|
||||
* - "u" for unicode
|
||||
* - "y" for sticky
|
||||
*
|
||||
* If no flags are set, the value is the empty string.
|
||||
*/
|
||||
readonly flags: string;
|
||||
|
||||
/**
|
||||
* Returns a Boolean value indicating the state of the sticky flag (y) used with a regular
|
||||
* expression. Default is false. Read-only.
|
||||
*/
|
||||
* Returns a Boolean value indicating the state of the sticky flag (y) used with a regular
|
||||
* expression. Default is false. Read-only.
|
||||
*/
|
||||
readonly sticky: boolean;
|
||||
|
||||
/**
|
||||
* Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular
|
||||
* expression. Default is false. Read-only.
|
||||
*/
|
||||
* Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular
|
||||
* expression. Default is false. Read-only.
|
||||
*/
|
||||
readonly unicode: boolean;
|
||||
}
|
||||
|
||||
@@ -426,64 +436,64 @@ interface RegExpConstructor {
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
|
||||
* value of the UTF-16 encoded code point starting at the string element at position pos in
|
||||
* the String resulting from converting this object to a String.
|
||||
* If there is no element at that position, the result is undefined.
|
||||
* If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
|
||||
*/
|
||||
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
|
||||
* value of the UTF-16 encoded code point starting at the string element at position pos in
|
||||
* the String resulting from converting this object to a String.
|
||||
* If there is no element at that position, the result is undefined.
|
||||
* If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
|
||||
*/
|
||||
codePointAt(pos: number): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns true if searchString appears as a substring of the result of converting this
|
||||
* object to a String, at one or more positions that are
|
||||
* greater than or equal to position; otherwise, returns false.
|
||||
* @param searchString search string
|
||||
* @param position If position is undefined, 0 is assumed, so as to search all of the String.
|
||||
*/
|
||||
* Returns true if searchString appears as a substring of the result of converting this
|
||||
* object to a String, at one or more positions that are
|
||||
* greater than or equal to position; otherwise, returns false.
|
||||
* @param searchString search string
|
||||
* @param position If position is undefined, 0 is assumed, so as to search all of the String.
|
||||
*/
|
||||
includes(searchString: string, position?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* endPosition – length(this). Otherwise returns false.
|
||||
*/
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* endPosition – length(this). Otherwise returns false.
|
||||
*/
|
||||
endsWith(searchString: string, endPosition?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns the String value result of normalizing the string into the normalization form
|
||||
* named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
|
||||
* @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default
|
||||
* is "NFC"
|
||||
*/
|
||||
* Returns the String value result of normalizing the string into the normalization form
|
||||
* named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
|
||||
* @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default
|
||||
* is "NFC"
|
||||
*/
|
||||
normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string;
|
||||
|
||||
/**
|
||||
* Returns the String value result of normalizing the string into the normalization form
|
||||
* named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
|
||||
* @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default
|
||||
* is "NFC"
|
||||
*/
|
||||
* Returns the String value result of normalizing the string into the normalization form
|
||||
* named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
|
||||
* @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default
|
||||
* is "NFC"
|
||||
*/
|
||||
normalize(form?: string): string;
|
||||
|
||||
/**
|
||||
* Returns a String value that is made from count copies appended together. If count is 0,
|
||||
* T is the empty String is returned.
|
||||
* @param count number of copies to append
|
||||
*/
|
||||
* Returns a String value that is made from count copies appended together. If count is 0,
|
||||
* T is the empty String is returned.
|
||||
* @param count number of copies to append
|
||||
*/
|
||||
repeat(count: number): string;
|
||||
|
||||
/**
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* position. Otherwise returns false.
|
||||
*/
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* position. Otherwise returns false.
|
||||
*/
|
||||
startsWith(searchString: string, position?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns an <a> HTML anchor element and sets the name attribute to the text value
|
||||
* @param name
|
||||
*/
|
||||
* Returns an <a> HTML anchor element and sets the name attribute to the text value
|
||||
* @param name
|
||||
*/
|
||||
anchor(name: string): string;
|
||||
|
||||
/** Returns a <big> HTML element */
|
||||
@@ -496,10 +506,10 @@ interface String {
|
||||
bold(): string;
|
||||
|
||||
/** Returns a <tt> HTML element */
|
||||
fixed(): string
|
||||
fixed(): string;
|
||||
|
||||
/** Returns a <font> HTML element and sets the color attribute value */
|
||||
fontcolor(color: string): string
|
||||
fontcolor(color: string): string;
|
||||
|
||||
/** Returns a <font> HTML element and sets the size attribute value */
|
||||
fontsize(size: number): string;
|
||||
@@ -528,17 +538,17 @@ interface String {
|
||||
|
||||
interface StringConstructor {
|
||||
/**
|
||||
* Return the String value whose elements are, in order, the elements in the List elements.
|
||||
* If length is 0, the empty string is returned.
|
||||
*/
|
||||
* Return the String value whose elements are, in order, the elements in the List elements.
|
||||
* If length is 0, the empty string is returned.
|
||||
*/
|
||||
fromCodePoint(...codePoints: number[]): string;
|
||||
|
||||
/**
|
||||
* String.raw is intended for use as a tag function of a Tagged Template String. When called
|
||||
* as such the first argument will be a well formed template call site object and the rest
|
||||
* parameter will contain the substitution values.
|
||||
* @param template A well-formed template string call site representation.
|
||||
* @param substitutions A set of substitution values.
|
||||
*/
|
||||
* String.raw is intended for use as a tag function of a Tagged Template String. When called
|
||||
* as such the first argument will be a well formed template call site object and the rest
|
||||
* parameter will contain the substitution values.
|
||||
* @param template A well-formed template string call site representation.
|
||||
* @param substitutions A set of substitution values.
|
||||
*/
|
||||
raw(template: TemplateStringsArray, ...substitutions: any[]): string;
|
||||
}
|
||||
|
||||
Vendored
+44
-4
@@ -18,15 +18,55 @@ and limitations under the License.
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface GeneratorFunction extends Function { }
|
||||
interface Generator extends Iterator<any> { }
|
||||
|
||||
interface GeneratorFunction {
|
||||
/**
|
||||
* Creates a new Generator object.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
new (...args: any[]): Generator;
|
||||
/**
|
||||
* Creates a new Generator object.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
(...args: any[]): Generator;
|
||||
/**
|
||||
* The length of the arguments.
|
||||
*/
|
||||
readonly length: number;
|
||||
/**
|
||||
* Returns the name of the function.
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
readonly prototype: Generator;
|
||||
}
|
||||
|
||||
interface GeneratorFunctionConstructor {
|
||||
/**
|
||||
* Creates a new Generator function.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
* Creates a new Generator function.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
new (...args: string[]): GeneratorFunction;
|
||||
/**
|
||||
* Creates a new Generator function.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
(...args: string[]): GeneratorFunction;
|
||||
/**
|
||||
* The length of the arguments.
|
||||
*/
|
||||
readonly length: number;
|
||||
/**
|
||||
* Returns the name of the function.
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
readonly prototype: GeneratorFunction;
|
||||
}
|
||||
declare var GeneratorFunction: GeneratorFunctionConstructor;
|
||||
|
||||
Vendored
+238
-200
@@ -21,10 +21,10 @@ and limitations under the License.
|
||||
/// <reference path="lib.es2015.symbol.d.ts" />
|
||||
|
||||
interface SymbolConstructor {
|
||||
/**
|
||||
* A method that returns the default iterator for an object. Called by the semantics of the
|
||||
* for-of statement.
|
||||
*/
|
||||
/**
|
||||
* A method that returns the default iterator for an object. Called by the semantics of the
|
||||
* for-of statement.
|
||||
*/
|
||||
readonly iterator: symbol;
|
||||
}
|
||||
|
||||
@@ -51,35 +51,37 @@ interface Array<T> {
|
||||
/** Iterator */
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, T]>;
|
||||
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<T>;
|
||||
}
|
||||
|
||||
interface ArrayConstructor {
|
||||
/**
|
||||
* Creates an array from an iterable object.
|
||||
* @param iterable An iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from<T, U>(iterable: Iterable<T>, mapfn: (v: T, k: number) => U, thisArg?: any): Array<U>;
|
||||
|
||||
* Creates an array from an iterable object.
|
||||
* @param iterable An iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from<T, U>(iterable: Iterable<T>, mapfn: (this: void, v: T, k: number) => U): Array<U>;
|
||||
from<T, U>(iterable: Iterable<T>, mapfn: (this: void, v: T, k: number) => U, thisArg: undefined): Array<U>;
|
||||
from<Z, T, U>(iterable: Iterable<T>, mapfn: (this: Z, v: T, k: number) => U, thisArg: Z): Array<U>;
|
||||
|
||||
/**
|
||||
* Creates an array from an iterable object.
|
||||
* @param iterable An iterable object to convert to an array.
|
||||
*/
|
||||
* Creates an array from an iterable object.
|
||||
* @param iterable An iterable object to convert to an array.
|
||||
*/
|
||||
from<T>(iterable: Iterable<T>): Array<T>;
|
||||
}
|
||||
|
||||
@@ -87,19 +89,19 @@ interface ReadonlyArray<T> {
|
||||
/** Iterator */
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, T]>;
|
||||
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<T>;
|
||||
}
|
||||
|
||||
@@ -109,7 +111,7 @@ interface IArguments {
|
||||
}
|
||||
|
||||
interface Map<K, V> {
|
||||
[Symbol.iterator](): IterableIterator<[K,V]>;
|
||||
[Symbol.iterator](): IterableIterator<[K, V]>;
|
||||
entries(): IterableIterator<[K, V]>;
|
||||
keys(): IterableIterator<K>;
|
||||
values(): IterableIterator<V>;
|
||||
@@ -139,22 +141,22 @@ interface SetConstructor {
|
||||
interface WeakSet<T> { }
|
||||
|
||||
interface WeakSetConstructor {
|
||||
new <T>(iterable: Iterable<T>): WeakSet<T>;
|
||||
new <T extends object>(iterable: Iterable<T>): WeakSet<T>;
|
||||
}
|
||||
|
||||
interface Promise<T> { }
|
||||
|
||||
interface PromiseConstructor {
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* 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.
|
||||
@@ -163,7 +165,7 @@ interface PromiseConstructor {
|
||||
}
|
||||
|
||||
declare namespace Reflect {
|
||||
function enumerate(target: any): IterableIterator<any>;
|
||||
function enumerate(target: object): IterableIterator<any>;
|
||||
}
|
||||
|
||||
interface String {
|
||||
@@ -172,22 +174,22 @@ interface String {
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
|
||||
* number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
|
||||
* number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Int8Array {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
@@ -195,31 +197,35 @@ interface Int8ArrayConstructor {
|
||||
new (elements: Iterable<number>): Int8Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array;
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Int8Array;
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int8Array;
|
||||
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int8Array;
|
||||
|
||||
from(arrayLike: Iterable<number>): Int8Array;
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Uint8Array {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
@@ -227,33 +233,37 @@ interface Uint8ArrayConstructor {
|
||||
new (elements: Iterable<number>): Uint8Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array;
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Uint8Array;
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint8Array;
|
||||
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint8Array;
|
||||
|
||||
from(arrayLike: Iterable<number>): Uint8Array;
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.
|
||||
* If the requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.
|
||||
* If the requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Uint8ClampedArray {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
@@ -262,33 +272,37 @@ interface Uint8ClampedArrayConstructor {
|
||||
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray;
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Uint8ClampedArray;
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint8ClampedArray;
|
||||
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint8ClampedArray;
|
||||
|
||||
from(arrayLike: Iterable<number>): Uint8ClampedArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 16-bit signed integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 16-bit signed integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Int16Array {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
@@ -296,31 +310,35 @@ interface Int16ArrayConstructor {
|
||||
new (elements: Iterable<number>): Int16Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array;
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Int16Array;
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int16Array;
|
||||
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int16Array;
|
||||
|
||||
from(arrayLike: Iterable<number>): Int16Array;
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Uint16Array {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
@@ -328,31 +346,35 @@ interface Uint16ArrayConstructor {
|
||||
new (elements: Iterable<number>): Uint16Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array;
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Uint16Array;
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint16Array;
|
||||
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint16Array;
|
||||
|
||||
from(arrayLike: Iterable<number>): Uint16Array;
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 32-bit signed integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 32-bit signed integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Int32Array {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
@@ -360,31 +382,35 @@ interface Int32ArrayConstructor {
|
||||
new (elements: Iterable<number>): Int32Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array;
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Int32Array;
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int32Array;
|
||||
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int32Array;
|
||||
|
||||
from(arrayLike: Iterable<number>): Int32Array;
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Uint32Array {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
@@ -392,31 +418,35 @@ interface Uint32ArrayConstructor {
|
||||
new (elements: Iterable<number>): Uint32Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array;
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Uint32Array;
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint32Array;
|
||||
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint32Array;
|
||||
|
||||
from(arrayLike: Iterable<number>): Uint32Array;
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 32-bit float values. The contents are initialized to 0. If the requested number
|
||||
* of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 32-bit float values. The contents are initialized to 0. If the requested number
|
||||
* of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Float32Array {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
@@ -424,31 +454,35 @@ interface Float32ArrayConstructor {
|
||||
new (elements: Iterable<number>): Float32Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array;
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Float32Array;
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Float32Array;
|
||||
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Float32Array;
|
||||
|
||||
from(arrayLike: Iterable<number>): Float32Array;
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 64-bit float values. The contents are initialized to 0. If the requested
|
||||
* number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 64-bit float values. The contents are initialized to 0. If the requested
|
||||
* number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Float64Array {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
@@ -456,10 +490,14 @@ interface Float64ArrayConstructor {
|
||||
new (elements: Iterable<number>): Float64Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number): Float64Array;
|
||||
from(arrayLike: Iterable<number>, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Float64Array;
|
||||
from<Z>(arrayLike: Iterable<number>, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Float64Array;
|
||||
|
||||
from(arrayLike: Iterable<number>): Float64Array;
|
||||
}
|
||||
|
||||
Vendored
+6
-6
@@ -20,8 +20,8 @@ and limitations under the License.
|
||||
|
||||
interface PromiseConstructor {
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
readonly prototype: Promise<any>;
|
||||
|
||||
/**
|
||||
@@ -207,10 +207,10 @@ interface PromiseConstructor {
|
||||
reject<T>(reason: any): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new resolved promise for the provided value.
|
||||
* @param value A promise.
|
||||
* @returns A promise whose internal state matches the provided promise.
|
||||
*/
|
||||
* Creates a new resolved promise for the provided value.
|
||||
* @param value A promise.
|
||||
* @returns A promise whose internal state matches the provided promise.
|
||||
*/
|
||||
resolve<T>(value: T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+4
-4
@@ -18,7 +18,7 @@ and limitations under the License.
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface ProxyHandler<T> {
|
||||
interface ProxyHandler<T extends object> {
|
||||
getPrototypeOf? (target: T): object | null;
|
||||
setPrototypeOf? (target: T, v: any): boolean;
|
||||
isExtensible? (target: T): boolean;
|
||||
@@ -32,11 +32,11 @@ interface ProxyHandler<T> {
|
||||
enumerate? (target: T): PropertyKey[];
|
||||
ownKeys? (target: T): PropertyKey[];
|
||||
apply? (target: T, thisArg: any, argArray?: any): any;
|
||||
construct? (target: T, argArray: any, newTarget?: any): object
|
||||
construct? (target: T, argArray: any, newTarget?: any): object;
|
||||
}
|
||||
|
||||
interface ProxyConstructor {
|
||||
revocable<T>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
|
||||
new <T>(target: T, handler: ProxyHandler<T>): T
|
||||
revocable<T extends object>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
|
||||
new <T extends object>(target: T, handler: ProxyHandler<T>): T;
|
||||
}
|
||||
declare var Proxy: ProxyConstructor;
|
||||
|
||||
Vendored
+12
-12
@@ -21,15 +21,15 @@ and limitations under the License.
|
||||
declare namespace Reflect {
|
||||
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
|
||||
function construct(target: Function, argumentsList: ArrayLike<any>, newTarget?: any): any;
|
||||
function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
|
||||
function deleteProperty(target: any, propertyKey: PropertyKey): boolean;
|
||||
function get(target: any, propertyKey: PropertyKey, receiver?: any): any;
|
||||
function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
|
||||
function getPrototypeOf(target: any): any;
|
||||
function has(target: any, propertyKey: PropertyKey): boolean;
|
||||
function isExtensible(target: any): boolean;
|
||||
function ownKeys(target: any): Array<PropertyKey>;
|
||||
function preventExtensions(target: any): boolean;
|
||||
function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
|
||||
function setPrototypeOf(target: any, proto: any): boolean;
|
||||
}
|
||||
function defineProperty(target: object, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
|
||||
function deleteProperty(target: object, propertyKey: PropertyKey): boolean;
|
||||
function get(target: object, propertyKey: PropertyKey, receiver?: any): any;
|
||||
function getOwnPropertyDescriptor(target: object, propertyKey: PropertyKey): PropertyDescriptor;
|
||||
function getPrototypeOf(target: object): object;
|
||||
function has(target: object, propertyKey: PropertyKey): boolean;
|
||||
function isExtensible(target: object): boolean;
|
||||
function ownKeys(target: object): Array<PropertyKey>;
|
||||
function preventExtensions(target: object): boolean;
|
||||
function set(target: object, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
|
||||
function setPrototypeOf(target: object, proto: any): boolean;
|
||||
}
|
||||
|
||||
Vendored
+15
-15
@@ -27,29 +27,29 @@ interface Symbol {
|
||||
}
|
||||
|
||||
interface SymbolConstructor {
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
readonly prototype: Symbol;
|
||||
|
||||
/**
|
||||
* Returns a new unique Symbol value.
|
||||
* @param description Description of the new Symbol object.
|
||||
*/
|
||||
(description?: string|number): symbol;
|
||||
* Returns a new unique Symbol value.
|
||||
* @param description Description of the new Symbol object.
|
||||
*/
|
||||
(description?: string | number): symbol;
|
||||
|
||||
/**
|
||||
* Returns a Symbol object from the global symbol registry matching the given key if found.
|
||||
* Otherwise, returns a new symbol with this key.
|
||||
* @param key key to search for.
|
||||
*/
|
||||
* Returns a Symbol object from the global symbol registry matching the given key if found.
|
||||
* Otherwise, returns a new symbol with this key.
|
||||
* @param key key to search for.
|
||||
*/
|
||||
for(key: string): symbol;
|
||||
|
||||
/**
|
||||
* Returns a key from the global symbol registry matching the given Symbol if found.
|
||||
* Otherwise, returns a undefined.
|
||||
* @param sym Symbol to find the key for.
|
||||
*/
|
||||
* Returns a key from the global symbol registry matching the given Symbol if found.
|
||||
* Otherwise, returns a undefined.
|
||||
* @param sym Symbol to find the key for.
|
||||
*/
|
||||
keyFor(sym: symbol): string | undefined;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+119
-119
@@ -21,64 +21,64 @@ and limitations under the License.
|
||||
/// <reference path="lib.es2015.symbol.d.ts" />
|
||||
|
||||
interface SymbolConstructor {
|
||||
/**
|
||||
* A method that determines if a constructor object recognizes an object as one of the
|
||||
* constructor’s instances. Called by the semantics of the instanceof operator.
|
||||
*/
|
||||
/**
|
||||
* A method that determines if a constructor object recognizes an object as one of the
|
||||
* constructor’s instances. Called by the semantics of the instanceof operator.
|
||||
*/
|
||||
readonly hasInstance: symbol;
|
||||
|
||||
/**
|
||||
* A Boolean value that if true indicates that an object should flatten to its array elements
|
||||
* by Array.prototype.concat.
|
||||
*/
|
||||
/**
|
||||
* A Boolean value that if true indicates that an object should flatten to its array elements
|
||||
* by Array.prototype.concat.
|
||||
*/
|
||||
readonly isConcatSpreadable: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that matches the regular expression against a string. Called
|
||||
* by the String.prototype.match method.
|
||||
*/
|
||||
* A regular expression method that matches the regular expression against a string. Called
|
||||
* by the String.prototype.match method.
|
||||
*/
|
||||
readonly match: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that replaces matched substrings of a string. Called by the
|
||||
* String.prototype.replace method.
|
||||
*/
|
||||
/**
|
||||
* A regular expression method that replaces matched substrings of a string. Called by the
|
||||
* String.prototype.replace method.
|
||||
*/
|
||||
readonly replace: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that returns the index within a string that matches the
|
||||
* regular expression. Called by the String.prototype.search method.
|
||||
*/
|
||||
* A regular expression method that returns the index within a string that matches the
|
||||
* regular expression. Called by the String.prototype.search method.
|
||||
*/
|
||||
readonly search: symbol;
|
||||
|
||||
/**
|
||||
* A function valued property that is the constructor function that is used to create
|
||||
* derived objects.
|
||||
*/
|
||||
/**
|
||||
* A function valued property that is the constructor function that is used to create
|
||||
* derived objects.
|
||||
*/
|
||||
readonly species: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that splits a string at the indices that match the regular
|
||||
* expression. Called by the String.prototype.split method.
|
||||
*/
|
||||
* A regular expression method that splits a string at the indices that match the regular
|
||||
* expression. Called by the String.prototype.split method.
|
||||
*/
|
||||
readonly split: symbol;
|
||||
|
||||
/**
|
||||
* A method that converts an object to a corresponding primitive value.
|
||||
* Called by the ToPrimitive abstract operation.
|
||||
*/
|
||||
/**
|
||||
* A method that converts an object to a corresponding primitive value.
|
||||
* Called by the ToPrimitive abstract operation.
|
||||
*/
|
||||
readonly toPrimitive: symbol;
|
||||
|
||||
/**
|
||||
* A String value that is used in the creation of the default string description of an object.
|
||||
* Called by the built-in method Object.prototype.toString.
|
||||
*/
|
||||
/**
|
||||
* A String value that is used in the creation of the default string description of an object.
|
||||
* Called by the built-in method Object.prototype.toString.
|
||||
*/
|
||||
readonly toStringTag: symbol;
|
||||
|
||||
/**
|
||||
* An Object whose own property names are property names that are excluded from the 'with'
|
||||
* environment bindings of the associated objects.
|
||||
*/
|
||||
* An Object whose own property names are property names that are excluded from the 'with'
|
||||
* environment bindings of the associated objects.
|
||||
*/
|
||||
readonly unscopables: symbol;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ interface Function {
|
||||
[Symbol.hasInstance](value: any): boolean;
|
||||
}
|
||||
|
||||
interface GeneratorFunction extends Function {
|
||||
interface GeneratorFunction {
|
||||
readonly [Symbol.toStringTag]: "GeneratorFunction";
|
||||
}
|
||||
|
||||
@@ -174,50 +174,50 @@ interface PromiseConstructor {
|
||||
}
|
||||
|
||||
interface RegExp {
|
||||
/**
|
||||
* Matches a string with this regular expression, and returns an array containing the results of
|
||||
* that search.
|
||||
* @param string A string to search within.
|
||||
*/
|
||||
/**
|
||||
* Matches a string with this regular expression, and returns an array containing the results of
|
||||
* that search.
|
||||
* @param string A string to search within.
|
||||
*/
|
||||
[Symbol.match](string: string): RegExpMatchArray | null;
|
||||
|
||||
/**
|
||||
* Replaces text in a string, using this regular expression.
|
||||
* @param string A String object or string literal whose contents matching against
|
||||
* this regular expression will be replaced
|
||||
* @param replaceValue A String object or string literal containing the text to replace for every
|
||||
* successful match of this regular expression.
|
||||
*/
|
||||
* Replaces text in a string, using this regular expression.
|
||||
* @param string A String object or string literal whose contents matching against
|
||||
* this regular expression will be replaced
|
||||
* @param replaceValue A String object or string literal containing the text to replace for every
|
||||
* successful match of this regular expression.
|
||||
*/
|
||||
[Symbol.replace](string: string, replaceValue: string): string;
|
||||
|
||||
/**
|
||||
* Replaces text in a string, using this regular expression.
|
||||
* @param string A String object or string literal whose contents matching against
|
||||
* this regular expression will be replaced
|
||||
* @param replacer A function that returns the replacement text.
|
||||
*/
|
||||
* Replaces text in a string, using this regular expression.
|
||||
* @param string A String object or string literal whose contents matching against
|
||||
* this regular expression will be replaced
|
||||
* @param replacer A function that returns the replacement text.
|
||||
*/
|
||||
[Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string;
|
||||
|
||||
/**
|
||||
* Finds the position beginning first substring match in a regular expression search
|
||||
* using this regular expression.
|
||||
*
|
||||
* @param string The string to search within.
|
||||
*/
|
||||
* Finds the position beginning first substring match in a regular expression search
|
||||
* using this regular expression.
|
||||
*
|
||||
* @param string The string to search within.
|
||||
*/
|
||||
[Symbol.search](string: string): number;
|
||||
|
||||
/**
|
||||
* Returns an array of substrings that were delimited by strings in the original input that
|
||||
* match against this regular expression.
|
||||
*
|
||||
* If the regular expression contains capturing parentheses, then each time this
|
||||
* regular expression matches, the results (including any undefined results) of the
|
||||
* capturing parentheses are spliced.
|
||||
*
|
||||
* @param string string value to split
|
||||
* @param limit if not undefined, the output array is truncated so that it contains no more
|
||||
* than 'limit' elements.
|
||||
*/
|
||||
* Returns an array of substrings that were delimited by strings in the original input that
|
||||
* match against this regular expression.
|
||||
*
|
||||
* If the regular expression contains capturing parentheses, then each time this
|
||||
* regular expression matches, the results (including any undefined results) of the
|
||||
* capturing parentheses are spliced.
|
||||
*
|
||||
* @param string string value to split
|
||||
* @param limit if not undefined, the output array is truncated so that it contains no more
|
||||
* than 'limit' elements.
|
||||
*/
|
||||
[Symbol.split](string: string, limit?: number): string[];
|
||||
}
|
||||
|
||||
@@ -227,45 +227,45 @@ interface RegExpConstructor {
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Matches a string an object that supports being matched against, and returns an array containing the results of that search.
|
||||
* @param matcher An object that supports being matched against.
|
||||
*/
|
||||
* Matches a string an object that supports being matched against, and returns an array containing the results of that search.
|
||||
* @param matcher An object that supports being matched against.
|
||||
*/
|
||||
match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null;
|
||||
|
||||
/**
|
||||
* Replaces text in a string, using an object that supports replacement within a string.
|
||||
* @param searchValue A object can search for and replace matches within a string.
|
||||
* @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.
|
||||
*/
|
||||
* Replaces text in a string, using an object that supports replacement within a string.
|
||||
* @param searchValue A object can search for and replace matches within a string.
|
||||
* @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.
|
||||
*/
|
||||
replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string;
|
||||
|
||||
/**
|
||||
* Replaces text in a string, using an object that supports replacement within a string.
|
||||
* @param searchValue A object can search for and replace matches within a string.
|
||||
* @param replacer A function that returns the replacement text.
|
||||
*/
|
||||
* Replaces text in a string, using an object that supports replacement within a string.
|
||||
* @param searchValue A object can search for and replace matches within a string.
|
||||
* @param replacer A function that returns the replacement text.
|
||||
*/
|
||||
replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string;
|
||||
|
||||
/**
|
||||
* Finds the first substring match in a regular expression search.
|
||||
* @param searcher An object which supports searching within a string.
|
||||
*/
|
||||
* Finds the first substring match in a regular expression search.
|
||||
* @param searcher An object which supports searching within a string.
|
||||
*/
|
||||
search(searcher: { [Symbol.search](string: string): number; }): number;
|
||||
|
||||
/**
|
||||
* Split a string into substrings using the specified separator and return them as an array.
|
||||
* @param splitter An object that can split a string.
|
||||
* @param limit A value used to limit the number of elements returned in the array.
|
||||
*/
|
||||
* Split a string into substrings using the specified separator and return them as an array.
|
||||
* @param splitter An object that can split a string.
|
||||
* @param limit A value used to limit the number of elements returned in the array.
|
||||
*/
|
||||
split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a raw buffer of binary data, which is used to store data for the
|
||||
* different typed arrays. ArrayBuffers cannot be read from or written to directly,
|
||||
* but can be passed to a typed array or DataView Object to interpret the raw
|
||||
* buffer as needed.
|
||||
*/
|
||||
* Represents a raw buffer of binary data, which is used to store data for the
|
||||
* different typed arrays. ArrayBuffers cannot be read from or written to directly,
|
||||
* but can be passed to a typed array or DataView Object to interpret the raw
|
||||
* buffer as needed.
|
||||
*/
|
||||
interface ArrayBuffer {
|
||||
readonly [Symbol.toStringTag]: "ArrayBuffer";
|
||||
}
|
||||
@@ -275,73 +275,73 @@ interface DataView {
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
|
||||
* number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
|
||||
* number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Int8Array {
|
||||
readonly [Symbol.toStringTag]: "Int8Array";
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Uint8Array {
|
||||
readonly [Symbol.toStringTag]: "UInt8Array";
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.
|
||||
* If the requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.
|
||||
* If the requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Uint8ClampedArray {
|
||||
readonly [Symbol.toStringTag]: "Uint8ClampedArray";
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 16-bit signed integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 16-bit signed integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Int16Array {
|
||||
readonly [Symbol.toStringTag]: "Int16Array";
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Uint16Array {
|
||||
readonly [Symbol.toStringTag]: "Uint16Array";
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 32-bit signed integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 32-bit signed integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Int32Array {
|
||||
readonly [Symbol.toStringTag]: "Int32Array";
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Uint32Array {
|
||||
readonly [Symbol.toStringTag]: "Uint32Array";
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 32-bit float values. The contents are initialized to 0. If the requested number
|
||||
* of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 32-bit float values. The contents are initialized to 0. If the requested number
|
||||
* of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Float32Array {
|
||||
readonly [Symbol.toStringTag]: "Float32Array";
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed array of 64-bit float values. The contents are initialized to 0. If the requested
|
||||
* number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
* A typed array of 64-bit float values. The contents are initialized to 0. If the requested
|
||||
* number of bytes could not be allocated an exception is raised.
|
||||
*/
|
||||
interface Float64Array {
|
||||
readonly [Symbol.toStringTag]: "Float64Array";
|
||||
}
|
||||
|
||||
Vendored
+44
-44
@@ -20,99 +20,99 @@ and limitations under the License.
|
||||
|
||||
interface Array<T> {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: T, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface ReadonlyArray<T> {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: T, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Int8Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Uint8Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Uint8ClampedArray {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Int16Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Uint16Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Int32Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Uint32Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Float32Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Float64Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
Vendored
+15468
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
@@ -21,4 +21,4 @@ and limitations under the License.
|
||||
/// <reference path="lib.es2016.d.ts" />
|
||||
/// <reference path="lib.es2017.object.d.ts" />
|
||||
/// <reference path="lib.es2017.sharedmemory.d.ts" />
|
||||
/// <reference path="lib.es2017.string.d.ts" />
|
||||
/// <reference path="lib.es2017.string.d.ts" />
|
||||
Vendored
+15470
File diff suppressed because it is too large
Load Diff
Vendored
+12
-12
@@ -20,26 +20,26 @@ and limitations under the License.
|
||||
|
||||
interface ObjectConstructor {
|
||||
/**
|
||||
* Returns an array of values of the enumerable properties 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.
|
||||
*/
|
||||
* Returns an array of values of the enumerable properties 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.
|
||||
*/
|
||||
values<T>(o: { [s: string]: T }): T[];
|
||||
|
||||
/**
|
||||
* Returns an array of values of the enumerable properties 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.
|
||||
*/
|
||||
* Returns an array of values of the enumerable properties 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.
|
||||
*/
|
||||
values(o: any): any[];
|
||||
|
||||
/**
|
||||
* Returns an array of key/values of the enumerable properties 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.
|
||||
*/
|
||||
* Returns an array of key/values of the enumerable properties 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.
|
||||
*/
|
||||
entries<T>(o: { [s: string]: T }): [string, T][];
|
||||
|
||||
/**
|
||||
* Returns an array of key/values of the enumerable properties 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.
|
||||
*/
|
||||
* Returns an array of key/values of the enumerable properties 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.
|
||||
*/
|
||||
entries(o: any): [string, any][];
|
||||
}
|
||||
|
||||
Vendored
+5
-5
@@ -23,8 +23,8 @@ and limitations under the License.
|
||||
|
||||
interface SharedArrayBuffer {
|
||||
/**
|
||||
* Read-only. The length of the ArrayBuffer (in bytes).
|
||||
*/
|
||||
* Read-only. The length of the ArrayBuffer (in bytes).
|
||||
*/
|
||||
readonly byteLength: number;
|
||||
|
||||
/*
|
||||
@@ -32,9 +32,9 @@ interface SharedArrayBuffer {
|
||||
*/
|
||||
length: number;
|
||||
/**
|
||||
* Returns a section of an SharedArrayBuffer.
|
||||
*/
|
||||
slice(begin:number, end?:number): SharedArrayBuffer;
|
||||
* Returns a section of an SharedArrayBuffer.
|
||||
*/
|
||||
slice(begin: number, end?: number): SharedArrayBuffer;
|
||||
readonly [Symbol.species]: SharedArrayBuffer;
|
||||
readonly [Symbol.toStringTag]: "SharedArrayBuffer";
|
||||
}
|
||||
|
||||
Vendored
+20
-20
@@ -20,28 +20,28 @@ and limitations under the License.
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
|
||||
* The padding is applied from the start (left) of the current string.
|
||||
*
|
||||
* @param maxLength The length of the resulting string once the current string has been padded.
|
||||
* If this parameter is smaller than the current string's length, the current string will be returned as it is.
|
||||
*
|
||||
* @param fillString The string to pad the current string with.
|
||||
* If this string is too long, it will be truncated and the left-most part will be applied.
|
||||
* The default value for this parameter is " " (U+0020).
|
||||
*/
|
||||
* Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
|
||||
* The padding is applied from the start (left) of the current string.
|
||||
*
|
||||
* @param maxLength The length of the resulting string once the current string has been padded.
|
||||
* If this parameter is smaller than the current string's length, the current string will be returned as it is.
|
||||
*
|
||||
* @param fillString The string to pad the current string with.
|
||||
* If this string is too long, it will be truncated and the left-most part will be applied.
|
||||
* The default value for this parameter is " " (U+0020).
|
||||
*/
|
||||
padStart(maxLength: number, fillString?: string): string;
|
||||
|
||||
/**
|
||||
* Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
|
||||
* The padding is applied from the end (right) of the current string.
|
||||
*
|
||||
* @param maxLength The length of the resulting string once the current string has been padded.
|
||||
* If this parameter is smaller than the current string's length, the current string will be returned as it is.
|
||||
*
|
||||
* @param fillString The string to pad the current string with.
|
||||
* If this string is too long, it will be truncated and the left-most part will be applied.
|
||||
* The default value for this parameter is " " (U+0020).
|
||||
*/
|
||||
* Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
|
||||
* The padding is applied from the end (right) of the current string.
|
||||
*
|
||||
* @param maxLength The length of the resulting string once the current string has been padded.
|
||||
* If this parameter is smaller than the current string's length, the current string will be returned as it is.
|
||||
*
|
||||
* @param fillString The string to pad the current string with.
|
||||
* If this string is too long, it will be truncated and the left-most part will be applied.
|
||||
* The default value for this parameter is " " (U+0020).
|
||||
*/
|
||||
padEnd(maxLength: number, fillString?: string): string;
|
||||
}
|
||||
|
||||
Vendored
+304
-203
File diff suppressed because it is too large
Load Diff
Vendored
+1382
-979
File diff suppressed because it is too large
Load Diff
Vendored
+44
@@ -0,0 +1,44 @@
|
||||
/*! *****************************************************************************
|
||||
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 path="lib.es2015.symbol.d.ts" />
|
||||
/// <reference path="lib.es2015.iterable.d.ts" />
|
||||
|
||||
interface SymbolConstructor {
|
||||
/**
|
||||
* A method that returns the default async iterator for an object. Called by the semantics of
|
||||
* the for-await-of statement.
|
||||
*/
|
||||
readonly asyncIterator: symbol;
|
||||
}
|
||||
|
||||
interface AsyncIterator<T> {
|
||||
next(value?: any): Promise<IteratorResult<T>>;
|
||||
return?(value?: any): Promise<IteratorResult<T>>;
|
||||
throw?(e?: any): Promise<IteratorResult<T>>;
|
||||
}
|
||||
|
||||
interface AsyncIterable<T> {
|
||||
[Symbol.asyncIterator](): AsyncIterator<T>;
|
||||
}
|
||||
|
||||
interface AsyncIterableIterator<T> extends AsyncIterator<T> {
|
||||
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
/*! *****************************************************************************
|
||||
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 path="lib.es2017.d.ts" />
|
||||
/// <reference path="lib.esnext.asynciterable.d.ts" />
|
||||
Vendored
+15469
File diff suppressed because it is too large
Load Diff
Vendored
+4
-4
@@ -49,7 +49,7 @@ interface TextStreamBase {
|
||||
|
||||
/**
|
||||
* Closes a text stream.
|
||||
* It is not necessary to close standard streams; they close automatically when the process ends. If
|
||||
* It is not necessary to close standard streams; they close automatically when the process ends. If
|
||||
* you close a standard stream, be aware that any other pointers to that standard stream become invalid.
|
||||
*/
|
||||
Close(): void;
|
||||
@@ -119,9 +119,9 @@ interface TextStreamReader extends TextStreamBase {
|
||||
|
||||
declare var WScript: {
|
||||
/**
|
||||
* Outputs text to either a message box (under WScript.exe) or the command console window followed by
|
||||
* a newline (under CScript.exe).
|
||||
*/
|
||||
* Outputs text to either a message box (under WScript.exe) or the command console window followed by
|
||||
* a newline (under CScript.exe).
|
||||
*/
|
||||
Echo(s: any): void;
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+146
-34
@@ -74,13 +74,17 @@ interface MessageEventInit extends EventInit {
|
||||
}
|
||||
|
||||
interface NotificationOptions {
|
||||
dir?: string;
|
||||
dir?: NotificationDirection;
|
||||
lang?: string;
|
||||
body?: string;
|
||||
tag?: string;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
interface ObjectURLOptions {
|
||||
oneTimeOnly?: boolean;
|
||||
}
|
||||
|
||||
interface PushSubscriptionOptionsInit {
|
||||
userVisibleOnly?: boolean;
|
||||
applicationServerKey?: any;
|
||||
@@ -91,11 +95,11 @@ interface RequestInit {
|
||||
headers?: any;
|
||||
body?: any;
|
||||
referrer?: string;
|
||||
referrerPolicy?: string;
|
||||
mode?: string;
|
||||
credentials?: string;
|
||||
cache?: string;
|
||||
redirect?: string;
|
||||
referrerPolicy?: ReferrerPolicy;
|
||||
mode?: RequestMode;
|
||||
credentials?: RequestCredentials;
|
||||
cache?: RequestCache;
|
||||
redirect?: RequestRedirect;
|
||||
integrity?: string;
|
||||
keepalive?: boolean;
|
||||
window?: any;
|
||||
@@ -109,7 +113,7 @@ interface ResponseInit {
|
||||
|
||||
interface ClientQueryOptions {
|
||||
includeUncontrolled?: boolean;
|
||||
type?: string;
|
||||
type?: ClientType;
|
||||
}
|
||||
|
||||
interface ExtendableEventInit extends EventInit {
|
||||
@@ -419,9 +423,9 @@ declare var Event: {
|
||||
}
|
||||
|
||||
interface EventTarget {
|
||||
addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
||||
dispatchEvent(evt: Event): boolean;
|
||||
removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
||||
}
|
||||
|
||||
declare var EventTarget: {
|
||||
@@ -481,7 +485,7 @@ declare var Headers: {
|
||||
}
|
||||
|
||||
interface IDBCursor {
|
||||
readonly direction: string;
|
||||
readonly direction: IDBCursorDirection;
|
||||
key: IDBKeyRange | IDBValidKey;
|
||||
readonly primaryKey: any;
|
||||
source: IDBObjectStore | IDBIndex;
|
||||
@@ -633,7 +637,7 @@ interface IDBRequest extends EventTarget {
|
||||
readonly error: DOMError;
|
||||
onerror: (this: IDBRequest, ev: Event) => any;
|
||||
onsuccess: (this: IDBRequest, ev: Event) => any;
|
||||
readonly readyState: string;
|
||||
readonly readyState: IDBRequestReadyState;
|
||||
readonly result: any;
|
||||
source: IDBObjectStore | IDBIndex | IDBCursor;
|
||||
readonly transaction: IDBTransaction;
|
||||
@@ -655,7 +659,7 @@ interface IDBTransactionEventMap {
|
||||
interface IDBTransaction extends EventTarget {
|
||||
readonly db: IDBDatabase;
|
||||
readonly error: DOMError;
|
||||
readonly mode: string;
|
||||
readonly mode: IDBTransactionMode;
|
||||
onabort: (this: IDBTransaction, ev: Event) => any;
|
||||
oncomplete: (this: IDBTransaction, ev: Event) => any;
|
||||
onerror: (this: IDBTransaction, ev: Event) => any;
|
||||
@@ -748,14 +752,14 @@ interface NotificationEventMap {
|
||||
|
||||
interface Notification extends EventTarget {
|
||||
readonly body: string;
|
||||
readonly dir: string;
|
||||
readonly dir: NotificationDirection;
|
||||
readonly icon: string;
|
||||
readonly lang: string;
|
||||
onclick: (this: Notification, ev: Event) => any;
|
||||
onclose: (this: Notification, ev: Event) => any;
|
||||
onerror: (this: Notification, ev: Event) => any;
|
||||
onshow: (this: Notification, ev: Event) => any;
|
||||
readonly permission: string;
|
||||
readonly permission: NotificationPermission;
|
||||
readonly tag: string;
|
||||
readonly title: string;
|
||||
close(): void;
|
||||
@@ -766,7 +770,7 @@ interface Notification extends EventTarget {
|
||||
declare var Notification: {
|
||||
prototype: Notification;
|
||||
new(title: string, options?: NotificationOptions): Notification;
|
||||
requestPermission(callback?: NotificationPermissionCallback): Promise<string>;
|
||||
requestPermission(callback?: NotificationPermissionCallback): Promise<NotificationPermission>;
|
||||
}
|
||||
|
||||
interface Performance {
|
||||
@@ -883,7 +887,7 @@ declare var ProgressEvent: {
|
||||
|
||||
interface PushManager {
|
||||
getSubscription(): Promise<PushSubscription>;
|
||||
permissionState(options?: PushSubscriptionOptionsInit): Promise<string>;
|
||||
permissionState(options?: PushSubscriptionOptionsInit): Promise<PushPermissionState>;
|
||||
subscribe(options?: PushSubscriptionOptionsInit): Promise<PushSubscription>;
|
||||
}
|
||||
|
||||
@@ -895,7 +899,7 @@ declare var PushManager: {
|
||||
interface PushSubscription {
|
||||
readonly endpoint: USVString;
|
||||
readonly options: PushSubscriptionOptions;
|
||||
getKey(name: string): ArrayBuffer | null;
|
||||
getKey(name: PushEncryptionKeyName): ArrayBuffer | null;
|
||||
toJSON(): any;
|
||||
unsubscribe(): Promise<boolean>;
|
||||
}
|
||||
@@ -938,18 +942,18 @@ declare var ReadableStreamReader: {
|
||||
}
|
||||
|
||||
interface Request extends Object, Body {
|
||||
readonly cache: string;
|
||||
readonly credentials: string;
|
||||
readonly destination: string;
|
||||
readonly cache: RequestCache;
|
||||
readonly credentials: RequestCredentials;
|
||||
readonly destination: RequestDestination;
|
||||
readonly headers: Headers;
|
||||
readonly integrity: string;
|
||||
readonly keepalive: boolean;
|
||||
readonly method: string;
|
||||
readonly mode: string;
|
||||
readonly redirect: string;
|
||||
readonly mode: RequestMode;
|
||||
readonly redirect: RequestRedirect;
|
||||
readonly referrer: string;
|
||||
readonly referrerPolicy: string;
|
||||
readonly type: string;
|
||||
readonly referrerPolicy: ReferrerPolicy;
|
||||
readonly type: RequestType;
|
||||
readonly url: string;
|
||||
clone(): Request;
|
||||
}
|
||||
@@ -965,7 +969,7 @@ interface Response extends Object, Body {
|
||||
readonly ok: boolean;
|
||||
readonly status: number;
|
||||
readonly statusText: string;
|
||||
readonly type: string;
|
||||
readonly type: ResponseType;
|
||||
readonly url: string;
|
||||
clone(): Response;
|
||||
}
|
||||
@@ -982,7 +986,7 @@ interface ServiceWorkerEventMap extends AbstractWorkerEventMap {
|
||||
interface ServiceWorker extends EventTarget, AbstractWorker {
|
||||
onstatechange: (this: ServiceWorker, ev: Event) => any;
|
||||
readonly scriptURL: USVString;
|
||||
readonly state: string;
|
||||
readonly state: ServiceWorkerState;
|
||||
postMessage(message: any, transfer?: any[]): void;
|
||||
addEventListener<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
@@ -1028,6 +1032,29 @@ declare var SyncManager: {
|
||||
new(): SyncManager;
|
||||
}
|
||||
|
||||
interface URL {
|
||||
hash: string;
|
||||
host: string;
|
||||
hostname: string;
|
||||
href: string;
|
||||
readonly origin: string;
|
||||
password: string;
|
||||
pathname: string;
|
||||
port: string;
|
||||
protocol: string;
|
||||
search: string;
|
||||
username: string;
|
||||
readonly searchParams: URLSearchParams;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
declare var URL: {
|
||||
prototype: URL;
|
||||
new(url: string, base?: string): URL;
|
||||
createObjectURL(object: any, options?: ObjectURLOptions): string;
|
||||
revokeObjectURL(url: string): void;
|
||||
}
|
||||
|
||||
interface WebSocketEventMap {
|
||||
"close": CloseEvent;
|
||||
"error": Event;
|
||||
@@ -1091,7 +1118,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
readonly readyState: number;
|
||||
readonly response: any;
|
||||
readonly responseText: string;
|
||||
responseType: string;
|
||||
responseType: XMLHttpRequestResponseType;
|
||||
readonly responseURL: string;
|
||||
readonly responseXML: any;
|
||||
readonly status: number;
|
||||
@@ -1242,7 +1269,7 @@ interface XMLHttpRequestEventTarget {
|
||||
}
|
||||
|
||||
interface Client {
|
||||
readonly frameType: string;
|
||||
readonly frameType: FrameType;
|
||||
readonly id: string;
|
||||
readonly url: USVString;
|
||||
postMessage(message: any, transfer?: any[]): void;
|
||||
@@ -1405,7 +1432,7 @@ declare var SyncEvent: {
|
||||
|
||||
interface WindowClient extends Client {
|
||||
readonly focused: boolean;
|
||||
readonly visibilityState: string;
|
||||
readonly visibilityState: VisibilityState;
|
||||
focus(): Promise<WindowClient>;
|
||||
navigate(url: USVString): Promise<WindowClient>;
|
||||
}
|
||||
@@ -1427,6 +1454,8 @@ interface WorkerGlobalScope extends EventTarget, WorkerUtils, WindowConsole, Glo
|
||||
readonly performance: Performance;
|
||||
readonly self: WorkerGlobalScope;
|
||||
msWriteProfilerMark(profilerMarkName: string): void;
|
||||
createImageBitmap(image: ImageBitmap | ImageData | Blob, options?: ImageBitmapOptions): Promise<ImageBitmap>;
|
||||
createImageBitmap(image: ImageBitmap | ImageData | Blob, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise<ImageBitmap>;
|
||||
addEventListener<K extends keyof WorkerGlobalScopeEventMap>(type: K, listener: (this: WorkerGlobalScope, ev: WorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
@@ -1487,6 +1516,56 @@ interface ErrorEventInit {
|
||||
error?: any;
|
||||
}
|
||||
|
||||
interface ImageBitmapOptions {
|
||||
imageOrientation?: "none" | "flipY";
|
||||
premultiplyAlpha?: "none" | "premultiply" | "default";
|
||||
colorSpaceConversion?: "none" | "default";
|
||||
resizeWidth?: number;
|
||||
resizeHeight?: number;
|
||||
resizeQuality?: "pixelated" | "low" | "medium" | "high";
|
||||
}
|
||||
|
||||
interface ImageBitmap {
|
||||
readonly width: number;
|
||||
readonly height: number;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
interface URLSearchParams {
|
||||
/**
|
||||
* Appends a specified key/value pair as a new search parameter.
|
||||
*/
|
||||
append(name: string, value: string): void;
|
||||
/**
|
||||
* Deletes the given search parameter, and its associated value, from the list of all search parameters.
|
||||
*/
|
||||
delete(name: string): void;
|
||||
/**
|
||||
* Returns the first value associated to the given search parameter.
|
||||
*/
|
||||
get(name: string): string | null;
|
||||
/**
|
||||
* Returns all the values association with a given search parameter.
|
||||
*/
|
||||
getAll(name: string): string[];
|
||||
/**
|
||||
* Returns a Boolean indicating if such a search parameter exists.
|
||||
*/
|
||||
has(name: string): boolean;
|
||||
/**
|
||||
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
|
||||
*/
|
||||
set(name: string, value: string): void;
|
||||
}
|
||||
|
||||
declare var URLSearchParams: {
|
||||
prototype: URLSearchParams;
|
||||
/**
|
||||
* Constructor returning a URLSearchParams object.
|
||||
*/
|
||||
new (init?: string | URLSearchParams): URLSearchParams;
|
||||
}
|
||||
|
||||
interface BlobPropertyBag {
|
||||
type?: string;
|
||||
endings?: string;
|
||||
@@ -1681,6 +1760,15 @@ interface JsonWebKey {
|
||||
k?: string;
|
||||
}
|
||||
|
||||
interface EventListenerOptions {
|
||||
capture?: boolean;
|
||||
}
|
||||
|
||||
interface AddEventListenerOptions extends EventListenerOptions {
|
||||
passive?: boolean;
|
||||
once?: boolean;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
@@ -1702,10 +1790,10 @@ interface FunctionStringCallback {
|
||||
(data: string): void;
|
||||
}
|
||||
interface ForEachCallback {
|
||||
(keyId: any, status: string): void;
|
||||
(keyId: any, status: MediaKeyStatus): void;
|
||||
}
|
||||
interface NotificationPermissionCallback {
|
||||
(permission: string): void;
|
||||
(permission: NotificationPermission): void;
|
||||
}
|
||||
declare var onmessage: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any;
|
||||
declare function close(): void;
|
||||
@@ -1717,8 +1805,10 @@ declare var onerror: (this: DedicatedWorkerGlobalScope, ev: ErrorEvent) => any;
|
||||
declare var performance: Performance;
|
||||
declare var self: WorkerGlobalScope;
|
||||
declare function msWriteProfilerMark(profilerMarkName: string): void;
|
||||
declare function createImageBitmap(image: ImageBitmap | ImageData | Blob, options?: ImageBitmapOptions): Promise<ImageBitmap>;
|
||||
declare function createImageBitmap(image: ImageBitmap | ImageData | Blob, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise<ImageBitmap>;
|
||||
declare function dispatchEvent(evt: Event): boolean;
|
||||
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
||||
declare var indexedDB: IDBFactory;
|
||||
declare var msIndexedDB: IDBFactory;
|
||||
declare var navigator: WorkerNavigator;
|
||||
@@ -1737,7 +1827,7 @@ declare function btoa(rawString: string): string;
|
||||
declare var console: Console;
|
||||
declare function fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
||||
declare function dispatchEvent(evt: Event): boolean;
|
||||
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
||||
declare function addEventListener<K extends keyof DedicatedWorkerGlobalScopeEventMap>(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
type AlgorithmIdentifier = string | Algorithm;
|
||||
@@ -1746,4 +1836,26 @@ type IDBKeyPath = string;
|
||||
type RequestInfo = Request | string;
|
||||
type USVString = string;
|
||||
type IDBValidKey = number | string | Date | IDBArrayKey;
|
||||
type BufferSource = ArrayBuffer | ArrayBufferView;
|
||||
type BufferSource = ArrayBuffer | ArrayBufferView;
|
||||
type FormDataEntryValue = string | File;
|
||||
type IDBCursorDirection = "next" | "nextunique" | "prev" | "prevunique";
|
||||
type IDBRequestReadyState = "pending" | "done";
|
||||
type IDBTransactionMode = "readonly" | "readwrite" | "versionchange";
|
||||
type MediaKeyStatus = "usable" | "expired" | "output-downscaled" | "output-not-allowed" | "status-pending" | "internal-error";
|
||||
type NotificationDirection = "auto" | "ltr" | "rtl";
|
||||
type NotificationPermission = "default" | "denied" | "granted";
|
||||
type PushEncryptionKeyName = "p256dh" | "auth";
|
||||
type PushPermissionState = "granted" | "denied" | "prompt";
|
||||
type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin-only" | "origin-when-cross-origin" | "unsafe-url";
|
||||
type RequestCache = "default" | "no-store" | "reload" | "no-cache" | "force-cache";
|
||||
type RequestCredentials = "omit" | "same-origin" | "include";
|
||||
type RequestDestination = "" | "document" | "sharedworker" | "subresource" | "unknown" | "worker";
|
||||
type RequestMode = "navigate" | "same-origin" | "no-cors" | "cors";
|
||||
type RequestRedirect = "follow" | "error" | "manual";
|
||||
type RequestType = "" | "audio" | "font" | "image" | "script" | "style" | "track" | "video";
|
||||
type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect";
|
||||
type ServiceWorkerState = "installing" | "installed" | "activating" | "activated" | "redundant";
|
||||
type VisibilityState = "hidden" | "visible" | "prerender" | "unloaded";
|
||||
type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text";
|
||||
type ClientType = "window" | "worker" | "sharedworker" | "all";
|
||||
type FrameType = "auxiliary" | "top-level" | "nested" | "none";
|
||||
Vendored
+511
-464
File diff suppressed because it is too large
Load Diff
+10410
-7991
File diff suppressed because it is too large
Load Diff
+15826
-11685
File diff suppressed because it is too large
Load Diff
Vendored
+718
-469
File diff suppressed because it is too large
Load Diff
+15681
-11654
File diff suppressed because it is too large
Load Diff
Vendored
+870
-541
File diff suppressed because it is too large
Load Diff
+17302
-12925
File diff suppressed because it is too large
Load Diff
Vendored
+870
-541
File diff suppressed because it is too large
Load Diff
+17302
-12925
File diff suppressed because it is too large
Load Diff
+1066
-835
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,27 @@
|
||||
/*! *****************************************************************************
|
||||
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.
|
||||
***************************************************************************** */
|
||||
|
||||
if (process.argv.length < 3) {
|
||||
process.exit(1);
|
||||
}
|
||||
var directoryName = process.argv[2];
|
||||
var fs = require("fs");
|
||||
try {
|
||||
var watcher = fs.watch(directoryName, { recursive: true }, function () { return ({}); });
|
||||
watcher.close();
|
||||
}
|
||||
catch (_e) {
|
||||
}
|
||||
process.exit(0);
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "typescript",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "http://typescriptlang.org/",
|
||||
"version": "2.3.0",
|
||||
"version": "2.4.0",
|
||||
"license": "Apache-2.0",
|
||||
"description": "TypeScript is a language for application scale JavaScript development",
|
||||
"keywords": [
|
||||
|
||||
+165
-82
@@ -361,7 +361,7 @@ namespace ts {
|
||||
// The presence of a particular fact means that the given test is true for some (and possibly all) values
|
||||
// of that kind of type.
|
||||
BaseStringStrictFacts = TypeofEQString | TypeofNENumber | TypeofNEBoolean | TypeofNESymbol | TypeofNEObject | TypeofNEFunction | TypeofNEHostObject | NEUndefined | NENull | NEUndefinedOrNull,
|
||||
BaseStringFacts = BaseStringStrictFacts | EQUndefined | EQNull | EQUndefinedOrNull | Falsy,
|
||||
BaseStringFacts = BaseStringStrictFacts | EQUndefined | EQNull | EQUndefinedOrNull | Falsy,
|
||||
StringStrictFacts = BaseStringStrictFacts | Truthy | Falsy,
|
||||
StringFacts = BaseStringFacts | Truthy,
|
||||
EmptyStringStrictFacts = BaseStringStrictFacts | Falsy,
|
||||
@@ -423,14 +423,20 @@ namespace ts {
|
||||
|
||||
let _jsxNamespace: string;
|
||||
let _jsxFactoryEntity: EntityName;
|
||||
let _jsxElementPropertiesName: string;
|
||||
let _hasComputedJsxElementPropertiesName = false;
|
||||
let _jsxElementChildrenPropertyName: string;
|
||||
let _hasComputedJsxElementChildrenPropertyName = false;
|
||||
|
||||
/** Things we lazy load from the JSX namespace */
|
||||
const jsxTypes = createMap<Type>();
|
||||
|
||||
const JsxNames = {
|
||||
JSX: "JSX",
|
||||
IntrinsicElements: "IntrinsicElements",
|
||||
ElementClass: "ElementClass",
|
||||
ElementAttributesPropertyNameContainer: "ElementAttributesProperty",
|
||||
ElementChildrenAttributeNameContainer: "ElementChildrenAttribute",
|
||||
Element: "Element",
|
||||
IntrinsicAttributes: "IntrinsicAttributes",
|
||||
IntrinsicClassAttributes: "IntrinsicClassAttributes"
|
||||
@@ -468,7 +474,7 @@ namespace ts {
|
||||
return checker;
|
||||
|
||||
function getJsxNamespace(): string {
|
||||
if (_jsxNamespace === undefined) {
|
||||
if (!_jsxNamespace) {
|
||||
_jsxNamespace = "React";
|
||||
if (compilerOptions.jsxFactory) {
|
||||
_jsxFactoryEntity = parseIsolatedEntityName(compilerOptions.jsxFactory, languageVersion);
|
||||
@@ -1628,17 +1634,21 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
// May be an untyped module. If so, ignore resolutionDiagnostic.
|
||||
// May be an untyped module. If so, ignore resolutionDiagnostic.
|
||||
if (!isRelative && resolvedModule && !extensionIsTypeScript(resolvedModule.extension)) {
|
||||
if (isForAugmentation) {
|
||||
const diag = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;
|
||||
error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName);
|
||||
}
|
||||
else if (noImplicitAny && moduleNotFoundError) {
|
||||
error(errorNode,
|
||||
let errorInfo = chainDiagnosticMessages(/*details*/ undefined,
|
||||
Diagnostics.Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0,
|
||||
moduleReference);
|
||||
errorInfo = chainDiagnosticMessages(errorInfo,
|
||||
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type,
|
||||
moduleReference,
|
||||
resolvedModule.resolvedFileName);
|
||||
diagnostics.add(createDiagnosticForNodeFromMessageChain(errorNode, errorInfo));
|
||||
}
|
||||
// Failed imports and untyped modules are both treated in an untyped manner; only difference is whether we give a diagnostic first.
|
||||
return undefined;
|
||||
@@ -3977,7 +3987,7 @@ namespace ts {
|
||||
type;
|
||||
}
|
||||
|
||||
function getTypeForDeclarationFromJSDocComment(declaration: Node ) {
|
||||
function getTypeForDeclarationFromJSDocComment(declaration: Node) {
|
||||
const jsdocType = getJSDocType(declaration);
|
||||
if (jsdocType) {
|
||||
return getTypeFromTypeNode(jsdocType);
|
||||
@@ -5644,7 +5654,7 @@ namespace ts {
|
||||
function getConstraintOfType(type: TypeVariable | UnionOrIntersectionType): Type {
|
||||
return type.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(<TypeParameter>type) :
|
||||
type.flags & TypeFlags.IndexedAccess ? getConstraintOfIndexedAccess(<IndexedAccessType>type) :
|
||||
getBaseConstraintOfType(type);
|
||||
getBaseConstraintOfType(type);
|
||||
}
|
||||
|
||||
function getConstraintOfTypeParameter(typeParameter: TypeParameter): Type {
|
||||
@@ -5717,7 +5727,7 @@ namespace ts {
|
||||
}
|
||||
return t.flags & TypeFlags.Union && baseTypes.length === types.length ? getUnionType(baseTypes) :
|
||||
t.flags & TypeFlags.Intersection && baseTypes.length ? getIntersectionType(baseTypes) :
|
||||
undefined;
|
||||
undefined;
|
||||
}
|
||||
if (t.flags & TypeFlags.Index) {
|
||||
return stringType;
|
||||
@@ -5768,11 +5778,11 @@ namespace ts {
|
||||
const t = type.flags & TypeFlags.TypeVariable ? getBaseConstraintOfType(type) || emptyObjectType : type;
|
||||
return t.flags & TypeFlags.Intersection ? getApparentTypeOfIntersectionType(<IntersectionType>t) :
|
||||
t.flags & TypeFlags.StringLike ? globalStringType :
|
||||
t.flags & TypeFlags.NumberLike ? globalNumberType :
|
||||
t.flags & TypeFlags.BooleanLike ? globalBooleanType :
|
||||
t.flags & TypeFlags.ESSymbol ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= ScriptTarget.ES2015) :
|
||||
t.flags & TypeFlags.NonPrimitive ? emptyObjectType :
|
||||
t;
|
||||
t.flags & TypeFlags.NumberLike ? globalNumberType :
|
||||
t.flags & TypeFlags.BooleanLike ? globalBooleanType :
|
||||
t.flags & TypeFlags.ESSymbol ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= ScriptTarget.ES2015) :
|
||||
t.flags & TypeFlags.NonPrimitive ? emptyObjectType :
|
||||
t;
|
||||
}
|
||||
|
||||
function createUnionOrIntersectionProperty(containingType: UnionOrIntersectionType, name: string): Symbol {
|
||||
@@ -7216,8 +7226,8 @@ namespace ts {
|
||||
function getIndexType(type: Type): Type {
|
||||
return maybeTypeOfKind(type, TypeFlags.TypeVariable) ? getIndexTypeForGenericType(<TypeVariable | UnionOrIntersectionType>type) :
|
||||
getObjectFlags(type) & ObjectFlags.Mapped ? getConstraintTypeFromMappedType(<MappedType>type) :
|
||||
type.flags & TypeFlags.Any || getIndexInfoOfType(type, IndexKind.String) ? stringType :
|
||||
getLiteralTypeFromPropertyNames(type);
|
||||
type.flags & TypeFlags.Any || getIndexInfoOfType(type, IndexKind.String) ? stringType :
|
||||
getLiteralTypeFromPropertyNames(type);
|
||||
}
|
||||
|
||||
function getIndexTypeOrString(type: Type): Type {
|
||||
@@ -7413,7 +7423,7 @@ namespace ts {
|
||||
* this function should be called in a left folding style, with left = previous result of getSpreadType
|
||||
* and right = the new element to be spread.
|
||||
*/
|
||||
function getSpreadType(left: Type, right: Type): Type {
|
||||
function getSpreadType(left: Type, right: Type): Type {
|
||||
if (left.flags & TypeFlags.Any || right.flags & TypeFlags.Any) {
|
||||
return anyType;
|
||||
}
|
||||
@@ -7713,7 +7723,7 @@ namespace ts {
|
||||
function createTypeMapper(sources: Type[], targets: Type[]): TypeMapper {
|
||||
const mapper: TypeMapper = sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) :
|
||||
sources.length === 2 ? makeBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) :
|
||||
makeArrayTypeMapper(sources, targets);
|
||||
makeArrayTypeMapper(sources, targets);
|
||||
mapper.mappedTypes = sources;
|
||||
return mapper;
|
||||
}
|
||||
@@ -8537,7 +8547,7 @@ namespace ts {
|
||||
(globalNumberType === source && numberType === target) ||
|
||||
(globalBooleanType === source && booleanType === target) ||
|
||||
(getGlobalESSymbolType(/*reportErrors*/ false) === source && esSymbolType === target)) {
|
||||
reportError(Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
|
||||
reportError(Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8718,7 +8728,7 @@ namespace ts {
|
||||
// Use this property as the error node as this will be more helpful in
|
||||
// reasoning about what went wrong.
|
||||
Debug.assert(!!errorNode);
|
||||
if (isJsxAttributes(errorNode)) {
|
||||
if (isJsxAttributes(errorNode) || isJsxOpeningLikeElement(errorNode)) {
|
||||
// JsxAttributes has an object-literal flag and undergo same type-assignablity check as normal object-literal.
|
||||
// However, using an object-literal error message will be very confusing to the users so we give different a message.
|
||||
reportError(Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(prop), typeToString(target));
|
||||
@@ -9661,25 +9671,25 @@ namespace ts {
|
||||
function isLiteralType(type: Type): boolean {
|
||||
return type.flags & TypeFlags.Boolean ? true :
|
||||
type.flags & TypeFlags.Union ? type.flags & TypeFlags.Enum ? true : !forEach((<UnionType>type).types, t => !isUnitType(t)) :
|
||||
isUnitType(type);
|
||||
isUnitType(type);
|
||||
}
|
||||
|
||||
function getBaseTypeOfLiteralType(type: Type): Type {
|
||||
return type.flags & TypeFlags.StringLiteral ? stringType :
|
||||
type.flags & TypeFlags.NumberLiteral ? numberType :
|
||||
type.flags & TypeFlags.BooleanLiteral ? booleanType :
|
||||
type.flags & TypeFlags.EnumLiteral ? (<EnumLiteralType>type).baseType :
|
||||
type.flags & TypeFlags.Union && !(type.flags & TypeFlags.Enum) ? getUnionType(sameMap((<UnionType>type).types, getBaseTypeOfLiteralType)) :
|
||||
type;
|
||||
type.flags & TypeFlags.BooleanLiteral ? booleanType :
|
||||
type.flags & TypeFlags.EnumLiteral ? (<EnumLiteralType>type).baseType :
|
||||
type.flags & TypeFlags.Union && !(type.flags & TypeFlags.Enum) ? getUnionType(sameMap((<UnionType>type).types, getBaseTypeOfLiteralType)) :
|
||||
type;
|
||||
}
|
||||
|
||||
function getWidenedLiteralType(type: Type): Type {
|
||||
return type.flags & TypeFlags.StringLiteral && type.flags & TypeFlags.FreshLiteral ? stringType :
|
||||
type.flags & TypeFlags.NumberLiteral && type.flags & TypeFlags.FreshLiteral ? numberType :
|
||||
type.flags & TypeFlags.BooleanLiteral ? booleanType :
|
||||
type.flags & TypeFlags.EnumLiteral ? (<EnumLiteralType>type).baseType :
|
||||
type.flags & TypeFlags.Union && !(type.flags & TypeFlags.Enum) ? getUnionType(sameMap((<UnionType>type).types, getWidenedLiteralType)) :
|
||||
type;
|
||||
type.flags & TypeFlags.BooleanLiteral ? booleanType :
|
||||
type.flags & TypeFlags.EnumLiteral ? (<EnumLiteralType>type).baseType :
|
||||
type.flags & TypeFlags.Union && !(type.flags & TypeFlags.Enum) ? getUnionType(sameMap((<UnionType>type).types, getWidenedLiteralType)) :
|
||||
type;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -9704,9 +9714,9 @@ namespace ts {
|
||||
function getFalsyFlags(type: Type): TypeFlags {
|
||||
return type.flags & TypeFlags.Union ? getFalsyFlagsOfTypes((<UnionType>type).types) :
|
||||
type.flags & TypeFlags.StringLiteral ? (<LiteralType>type).text === "" ? TypeFlags.StringLiteral : 0 :
|
||||
type.flags & TypeFlags.NumberLiteral ? (<LiteralType>type).text === "0" ? TypeFlags.NumberLiteral : 0 :
|
||||
type.flags & TypeFlags.BooleanLiteral ? type === falseType ? TypeFlags.BooleanLiteral : 0 :
|
||||
type.flags & TypeFlags.PossiblyFalsy;
|
||||
type.flags & TypeFlags.NumberLiteral ? (<LiteralType>type).text === "0" ? TypeFlags.NumberLiteral : 0 :
|
||||
type.flags & TypeFlags.BooleanLiteral ? type === falseType ? TypeFlags.BooleanLiteral : 0 :
|
||||
type.flags & TypeFlags.PossiblyFalsy;
|
||||
}
|
||||
|
||||
function includeFalsyTypes(type: Type, flags: TypeFlags) {
|
||||
@@ -10882,8 +10892,8 @@ namespace ts {
|
||||
isTypeSubsetOf(numberType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, TypeFlags.NumberLiteral)) {
|
||||
return mapType(typeWithPrimitives, t =>
|
||||
t.flags & TypeFlags.String ? extractTypesOfKind(typeWithLiterals, TypeFlags.String | TypeFlags.StringLiteral) :
|
||||
t.flags & TypeFlags.Number ? extractTypesOfKind(typeWithLiterals, TypeFlags.Number | TypeFlags.NumberLiteral) :
|
||||
t);
|
||||
t.flags & TypeFlags.Number ? extractTypesOfKind(typeWithLiterals, TypeFlags.Number | TypeFlags.NumberLiteral) :
|
||||
t);
|
||||
}
|
||||
return typeWithPrimitives;
|
||||
}
|
||||
@@ -11459,7 +11469,7 @@ namespace ts {
|
||||
const discriminantType = getUnionType(clauseTypes);
|
||||
const caseType =
|
||||
discriminantType.flags & TypeFlags.Never ? neverType :
|
||||
replacePrimitivesWithLiterals(filterType(type, t => isTypeComparableTo(discriminantType, t)), discriminantType);
|
||||
replacePrimitivesWithLiterals(filterType(type, t => isTypeComparableTo(discriminantType, t)), discriminantType);
|
||||
if (!hasDefaultClause) {
|
||||
return caseType;
|
||||
}
|
||||
@@ -11539,8 +11549,8 @@ namespace ts {
|
||||
// two types.
|
||||
return isTypeSubtypeOf(candidate, type) ? candidate :
|
||||
isTypeAssignableTo(type, candidate) ? type :
|
||||
isTypeAssignableTo(candidate, type) ? candidate :
|
||||
getIntersectionType([type, candidate]);
|
||||
isTypeAssignableTo(candidate, type) ? candidate :
|
||||
getIntersectionType([type, candidate]);
|
||||
}
|
||||
|
||||
function narrowTypeByTypePredicate(type: Type, callExpression: CallExpression, assumeTrue: boolean): Type {
|
||||
@@ -11559,7 +11569,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (isIdentifierTypePredicate(predicate)) {
|
||||
const predicateArgument = callExpression.arguments[predicate.parameterIndex];
|
||||
const predicateArgument = callExpression.arguments[predicate.parameterIndex - (signature.thisParameter ? 1 : 0)];
|
||||
if (predicateArgument) {
|
||||
if (isMatchingReference(reference, predicateArgument)) {
|
||||
return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
|
||||
@@ -11801,11 +11811,11 @@ namespace ts {
|
||||
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
|
||||
// declaration container are the same).
|
||||
const assumeInitialized = isParameter || isOuterVariable ||
|
||||
type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & TypeFlags.Any) !== 0 || isInTypeQuery(node)) ||
|
||||
type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & TypeFlags.Any) !== 0 || isInTypeQuery(node) || node.parent.kind === SyntaxKind.ExportSpecifier) ||
|
||||
isInAmbientContext(declaration);
|
||||
const initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, getRootDeclaration(declaration) as VariableLikeDeclaration) : type) :
|
||||
type === autoType || type === autoArrayType ? undefinedType :
|
||||
includeFalsyTypes(type, TypeFlags.Undefined);
|
||||
includeFalsyTypes(type, TypeFlags.Undefined);
|
||||
const flowType = getFlowTypeOfReference(node, type, initialType, flowContainer, !assumeInitialized);
|
||||
// A variable is considered uninitialized when it is possible to analyze the entire control flow graph
|
||||
// from declaration to use, and when the variable's declared type doesn't include undefined but the
|
||||
@@ -12288,7 +12298,7 @@ namespace ts {
|
||||
func.kind === SyntaxKind.GetAccessor ||
|
||||
func.kind === SyntaxKind.SetAccessor) && func.parent.kind === SyntaxKind.ObjectLiteralExpression ? <ObjectLiteralExpression>func.parent :
|
||||
func.kind === SyntaxKind.FunctionExpression && func.parent.kind === SyntaxKind.PropertyAssignment ? <ObjectLiteralExpression>func.parent.parent :
|
||||
undefined;
|
||||
undefined;
|
||||
}
|
||||
|
||||
function getThisTypeArgument(type: Type): Type {
|
||||
@@ -12619,6 +12629,36 @@ namespace ts {
|
||||
return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined;
|
||||
}
|
||||
|
||||
function getContextualTypeForJsxExpression(node: JsxExpression): Type {
|
||||
// JSX expression can appear in two position : JSX Element's children or JSX attribute
|
||||
const jsxAttributes = isJsxAttributeLike(node.parent) ?
|
||||
node.parent.parent :
|
||||
node.parent.openingElement.attributes; // node.parent is JsxElement
|
||||
|
||||
// When we trying to resolve JsxOpeningLikeElement as a stateless function element, we will already give its attributes a contextual type
|
||||
// which is a type of the parameter of the signature we are trying out.
|
||||
// If there is no contextual type (e.g. we are trying to resolve stateful component), get attributes type from resolving element's tagName
|
||||
const attributesType = getContextualType(jsxAttributes);
|
||||
|
||||
if (!attributesType || isTypeAny(attributesType)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (isJsxAttribute(node.parent)) {
|
||||
// JSX expression is in JSX attribute
|
||||
return getTypeOfPropertyOfType(attributesType, (node.parent as JsxAttribute).name.text);
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.JsxElement) {
|
||||
// JSX expression is in children of JSX Element, we will look for an "children" atttribute (we get the name from JSX.ElementAttributesProperty)
|
||||
const jsxChildrenPropertyName = getJsxElementChildrenPropertyname();
|
||||
return jsxChildrenPropertyName && jsxChildrenPropertyName !== "" ? getTypeOfPropertyOfType(attributesType, jsxChildrenPropertyName) : anyType;
|
||||
}
|
||||
else {
|
||||
// JSX expression is in JSX spread attribute
|
||||
return attributesType;
|
||||
}
|
||||
}
|
||||
|
||||
function getContextualTypeForJsxAttribute(attribute: JsxAttribute | JsxSpreadAttribute) {
|
||||
// When we trying to resolve JsxOpeningLikeElement as a stateless function element, we will already give its attributes a contextual type
|
||||
// which is a type of the parameter of the signature we are trying out.
|
||||
@@ -12692,6 +12732,8 @@ namespace ts {
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
return getContextualTypeForObjectLiteralElement(<ObjectLiteralElementLike>parent);
|
||||
case SyntaxKind.SpreadAssignment:
|
||||
return getApparentTypeOfContextualType(parent.parent as ObjectLiteralExpression);
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return getContextualTypeForElementExpression(node);
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
@@ -12702,7 +12744,7 @@ namespace ts {
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return getContextualType(<ParenthesizedExpression>parent);
|
||||
case SyntaxKind.JsxExpression:
|
||||
return getContextualType(<JsxExpression>parent);
|
||||
return getContextualTypeForJsxExpression(<JsxExpression>parent);
|
||||
case SyntaxKind.JsxAttribute:
|
||||
case SyntaxKind.JsxSpreadAttribute:
|
||||
return getContextualTypeForJsxAttribute(<JsxAttribute | JsxSpreadAttribute>parent);
|
||||
@@ -13157,21 +13199,6 @@ namespace ts {
|
||||
checkExpression(node.closingElement.tagName);
|
||||
}
|
||||
|
||||
// Check children
|
||||
for (const child of node.children) {
|
||||
switch (child.kind) {
|
||||
case SyntaxKind.JsxExpression:
|
||||
checkJsxExpression(<JsxExpression>child);
|
||||
break;
|
||||
case SyntaxKind.JsxElement:
|
||||
checkJsxElement(<JsxElement>child);
|
||||
break;
|
||||
case SyntaxKind.JsxSelfClosingElement:
|
||||
checkJsxSelfClosingElement(<JsxSelfClosingElement>child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return getJsxGlobalElementType() || anyType;
|
||||
}
|
||||
|
||||
@@ -13264,6 +13291,42 @@ namespace ts {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Handle children attribute
|
||||
const parent = openingLikeElement.parent.kind === SyntaxKind.JsxElement ? openingLikeElement.parent as JsxElement : 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) {
|
||||
const childrenTypes: Type[] = [];
|
||||
for (const child of (parent as JsxElement).children) {
|
||||
// In React, JSX text that contains only whitespaces will be ignored so we don't want to type-check that
|
||||
// because then type of children property will have constituent of string type.
|
||||
if (child.kind === SyntaxKind.JsxText) {
|
||||
if (!child.containsOnlyWhiteSpaces) {
|
||||
childrenTypes.push(stringType);
|
||||
}
|
||||
}
|
||||
else {
|
||||
childrenTypes.push(checkExpression(child, checkMode));
|
||||
}
|
||||
}
|
||||
|
||||
// Error if there is a attribute named "children" and children element.
|
||||
// This is because children element will overwrite the value from attributes
|
||||
const jsxChildrenPropertyName = getJsxElementChildrenPropertyname();
|
||||
if (jsxChildrenPropertyName && jsxChildrenPropertyName !== "") {
|
||||
if (attributesTable.has(jsxChildrenPropertyName)) {
|
||||
error(attributes, Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, jsxChildrenPropertyName);
|
||||
}
|
||||
|
||||
// If there are children in the body of JSX element, create dummy attribute "children" with anyType so that it will pass the attribute checking process
|
||||
const childrenPropSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, jsxChildrenPropertyName);
|
||||
childrenPropSymbol.type = childrenTypes.length === 1 ?
|
||||
childrenTypes[0] :
|
||||
createArrayType(getUnionType(childrenTypes, /*subtypeReduction*/ false));
|
||||
attributesTable.set(jsxChildrenPropertyName, childrenPropSymbol);
|
||||
}
|
||||
}
|
||||
|
||||
return createJsxAttributesType(attributes.symbol, attributesTable);
|
||||
|
||||
/**
|
||||
@@ -13363,41 +13426,61 @@ namespace ts {
|
||||
return getUnionType(map(signatures, getReturnTypeOfSignature), /*subtypeReduction*/ true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Look into JSX namespace and then look for container with matching name as nameOfAttribPropContainer.
|
||||
* Get a single property from that container if existed. Report an error if there are more than one property.
|
||||
*
|
||||
* @param nameOfAttribPropContainer a string of value JsxNames.ElementAttributesPropertyNameContainer or JsxNames.ElementChildrenAttributeNameContainer
|
||||
* if other string is given or the container doesn't exist, return undefined.
|
||||
*/
|
||||
function getNameFromJsxElementAttributesContainer(nameOfAttribPropContainer: string): string {
|
||||
// JSX
|
||||
const jsxNamespace = getGlobalSymbol(JsxNames.JSX, SymbolFlags.Namespace, /*diagnosticMessage*/ undefined);
|
||||
// JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute [symbol]
|
||||
const jsxElementAttribPropInterfaceSym = jsxNamespace && getSymbol(jsxNamespace.exports, nameOfAttribPropContainer, SymbolFlags.Type);
|
||||
// JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute [type]
|
||||
const jsxElementAttribPropInterfaceType = jsxElementAttribPropInterfaceSym && getDeclaredTypeOfSymbol(jsxElementAttribPropInterfaceSym);
|
||||
// The properties of JSX.ElementAttributesProperty | JSX.ElementChildrenAttribute
|
||||
const propertiesOfJsxElementAttribPropInterface = jsxElementAttribPropInterfaceType && getPropertiesOfType(jsxElementAttribPropInterfaceType);
|
||||
if (propertiesOfJsxElementAttribPropInterface) {
|
||||
// Element Attributes has zero properties, so the element attributes type will be the class instance type
|
||||
if (propertiesOfJsxElementAttribPropInterface.length === 0) {
|
||||
return "";
|
||||
}
|
||||
// Element Attributes has one property, so the element attributes type will be the type of the corresponding
|
||||
// property of the class instance type
|
||||
else if (propertiesOfJsxElementAttribPropInterface.length === 1) {
|
||||
return propertiesOfJsxElementAttribPropInterface[0].name;
|
||||
}
|
||||
else if (propertiesOfJsxElementAttribPropInterface.length > 1) {
|
||||
// More than one property on ElementAttributesProperty is an error
|
||||
error(jsxElementAttribPropInterfaceSym.declarations[0], Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, nameOfAttribPropContainer);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/// e.g. "props" for React.d.ts,
|
||||
/// or 'undefined' if ElementAttributesProperty doesn't exist (which means all
|
||||
/// non-intrinsic elements' attributes type is 'any'),
|
||||
/// or '' if it has 0 properties (which means every
|
||||
/// non-intrinsic elements' attributes type is the element instance type)
|
||||
function getJsxElementPropertiesName() {
|
||||
// JSX
|
||||
const jsxNamespace = getGlobalSymbol(JsxNames.JSX, SymbolFlags.Namespace, /*diagnosticMessage*/ undefined);
|
||||
// JSX.ElementAttributesProperty [symbol]
|
||||
const attribsPropTypeSym = jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.ElementAttributesPropertyNameContainer, SymbolFlags.Type);
|
||||
// JSX.ElementAttributesProperty [type]
|
||||
const attribPropType = attribsPropTypeSym && getDeclaredTypeOfSymbol(attribsPropTypeSym);
|
||||
// The properties of JSX.ElementAttributesProperty
|
||||
const attribProperties = attribPropType && getPropertiesOfType(attribPropType);
|
||||
if (!_hasComputedJsxElementPropertiesName) {
|
||||
_hasComputedJsxElementPropertiesName = true;
|
||||
_jsxElementPropertiesName = getNameFromJsxElementAttributesContainer(JsxNames.ElementAttributesPropertyNameContainer);
|
||||
}
|
||||
|
||||
if (attribProperties) {
|
||||
// Element Attributes has zero properties, so the element attributes type will be the class instance type
|
||||
if (attribProperties.length === 0) {
|
||||
return "";
|
||||
}
|
||||
// Element Attributes has one property, so the element attributes type will be the type of the corresponding
|
||||
// property of the class instance type
|
||||
else if (attribProperties.length === 1) {
|
||||
return attribProperties[0].name;
|
||||
}
|
||||
// More than one property on ElementAttributesProperty is an error
|
||||
else {
|
||||
error(attribsPropTypeSym.declarations[0], Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, JsxNames.ElementAttributesPropertyNameContainer);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// No interface exists, so the element attributes type will be an implicit any
|
||||
return undefined;
|
||||
return _jsxElementPropertiesName;
|
||||
}
|
||||
|
||||
function getJsxElementChildrenPropertyname(): string {
|
||||
if (!_hasComputedJsxElementChildrenPropertyName) {
|
||||
_hasComputedJsxElementChildrenPropertyName = true;
|
||||
_jsxElementChildrenPropertyName = getNameFromJsxElementAttributesContainer(JsxNames.ElementChildrenAttributeNameContainer);
|
||||
}
|
||||
|
||||
return _jsxElementChildrenPropertyName;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
namespace ts {
|
||||
/** The version of the TypeScript compiler release */
|
||||
export const version = "2.3.0";
|
||||
export const version = "2.4.0";
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
|
||||
@@ -2119,6 +2119,10 @@
|
||||
"category": "Error",
|
||||
"code": 2709
|
||||
},
|
||||
"'{0}' are specified twice. The attribute named '{0}' will be overwritten.": {
|
||||
"category": "Error",
|
||||
"code": 2710
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
@@ -3306,6 +3310,10 @@
|
||||
"category": "Error",
|
||||
"code": 7034
|
||||
},
|
||||
"Try `npm install @types/{0}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`": {
|
||||
"category": "Error",
|
||||
"code": 7035
|
||||
},
|
||||
"You cannot rename this element.": {
|
||||
"category": "Error",
|
||||
"code": 8000
|
||||
|
||||
@@ -2457,7 +2457,7 @@ namespace ts {
|
||||
let indentation: number;
|
||||
for (const line of lines) {
|
||||
for (let i = 0; i < line.length && (indentation === undefined || i < indentation); i++) {
|
||||
if (!isWhiteSpace(line.charCodeAt(i))) {
|
||||
if (!isWhiteSpaceLike(line.charCodeAt(i))) {
|
||||
if (indentation === undefined || i < indentation) {
|
||||
indentation = i;
|
||||
break;
|
||||
|
||||
@@ -368,6 +368,18 @@ namespace ts {
|
||||
: node;
|
||||
}
|
||||
|
||||
export function createParenthesizedType(type: TypeNode) {
|
||||
const node = <ParenthesizedTypeNode>createSynthesizedNode(SyntaxKind.ParenthesizedType);
|
||||
node.type = type;
|
||||
return node;
|
||||
}
|
||||
|
||||
export function updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode) {
|
||||
return node.type !== type
|
||||
? updateNode(createParenthesizedType(type), node)
|
||||
: node;
|
||||
}
|
||||
|
||||
export function createTypeLiteralNode(members: TypeElement[]) {
|
||||
const typeLiteralNode = createSynthesizedNode(SyntaxKind.TypeLiteral) as TypeLiteralNode;
|
||||
typeLiteralNode.members = createNodeArray(members);
|
||||
@@ -2937,6 +2949,28 @@ namespace ts {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the internal name of a declaration. This is primarily used for declarations that can be
|
||||
* referred to by name in the body of an ES5 class function body. An internal name will *never*
|
||||
* be prefixed with an module or namespace export modifier like "exports." when emitted as an
|
||||
* expression. An internal name will also *never* be renamed due to a collision with a block
|
||||
* scoped variable.
|
||||
*
|
||||
* @param node The declaration.
|
||||
* @param allowComments A value indicating whether comments may be emitted for the name.
|
||||
* @param allowSourceMaps A value indicating whether source maps may be emitted for the name.
|
||||
*/
|
||||
export function getInternalName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean) {
|
||||
return getName(node, allowComments, allowSourceMaps, EmitFlags.LocalName | EmitFlags.InternalName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether an identifier should only be referred to by its internal name.
|
||||
*/
|
||||
export function isInternalName(node: Identifier) {
|
||||
return (getEmitFlags(node) & EmitFlags.InternalName) !== 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the local name of a declaration. This is primarily used for declarations that can be
|
||||
* referred to by name in the declaration's immediate scope (classes, enums, namespaces). A
|
||||
|
||||
@@ -3828,6 +3828,7 @@ namespace ts {
|
||||
|
||||
function parseJsxText(): JsxText {
|
||||
const node = <JsxText>createNode(SyntaxKind.JsxText, scanner.getStartPos());
|
||||
node.containsOnlyWhiteSpaces = currentToken === SyntaxKind.JsxTextAllWhiteSpaces;
|
||||
currentToken = scanner.scanJsxToken();
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -3835,6 +3836,7 @@ namespace ts {
|
||||
function parseJsxChild(): JsxChild {
|
||||
switch (token()) {
|
||||
case SyntaxKind.JsxText:
|
||||
case SyntaxKind.JsxTextAllWhiteSpaces:
|
||||
return parseJsxText();
|
||||
case SyntaxKind.OpenBraceToken:
|
||||
return parseJsxExpression(/*inExpressionContext*/ false);
|
||||
@@ -3864,7 +3866,10 @@ namespace ts {
|
||||
else if (token() === SyntaxKind.ConflictMarkerTrivia) {
|
||||
break;
|
||||
}
|
||||
result.push(parseJsxChild());
|
||||
const child = parseJsxChild();
|
||||
if (child) {
|
||||
result.push(child);
|
||||
}
|
||||
}
|
||||
|
||||
result.end = scanner.getTokenPos();
|
||||
|
||||
@@ -908,6 +908,13 @@ namespace ts {
|
||||
|
||||
function getSemanticDiagnosticsForFileNoCache(sourceFile: SourceFile, cancellationToken: CancellationToken): Diagnostic[] {
|
||||
return runWithCancellationToken(() => {
|
||||
// If skipLibCheck is enabled, skip reporting errors if file is a declaration file.
|
||||
// If skipDefaultLibCheck is enabled, skip reporting errors if file contains a
|
||||
// '/// <reference no-default-lib="true"/>' directive.
|
||||
if (options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib) {
|
||||
return emptyArray;
|
||||
}
|
||||
|
||||
const typeChecker = getDiagnosticsProducingTypeChecker();
|
||||
|
||||
Debug.assert(!!sourceFile.bindDiagnostics);
|
||||
|
||||
+24
-5
@@ -367,7 +367,7 @@ namespace ts {
|
||||
return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position);
|
||||
}
|
||||
|
||||
export function isWhiteSpace(ch: number): boolean {
|
||||
export function isWhiteSpaceLike(ch: number): boolean {
|
||||
return isWhiteSpaceSingleLine(ch) || isLineBreak(ch);
|
||||
}
|
||||
|
||||
@@ -512,7 +512,7 @@ namespace ts {
|
||||
break;
|
||||
|
||||
default:
|
||||
if (ch > CharacterCodes.maxAsciiCharacter && (isWhiteSpace(ch))) {
|
||||
if (ch > CharacterCodes.maxAsciiCharacter && (isWhiteSpaceLike(ch))) {
|
||||
pos++;
|
||||
continue;
|
||||
}
|
||||
@@ -694,7 +694,7 @@ namespace ts {
|
||||
}
|
||||
break scan;
|
||||
default:
|
||||
if (ch > CharacterCodes.maxAsciiCharacter && (isWhiteSpace(ch))) {
|
||||
if (ch > CharacterCodes.maxAsciiCharacter && (isWhiteSpaceLike(ch))) {
|
||||
if (hasPendingCommentRange && isLineBreak(ch)) {
|
||||
pendingHasTrailingNewLine = true;
|
||||
}
|
||||
@@ -1727,8 +1727,12 @@ namespace ts {
|
||||
return token = SyntaxKind.OpenBraceToken;
|
||||
}
|
||||
|
||||
// First non-whitespace character on this line.
|
||||
let firstNonWhitespace = 0;
|
||||
// These initial values are special because the first line is:
|
||||
// firstNonWhitespace = 0 to indicate that we want leading whitspace,
|
||||
|
||||
while (pos < end) {
|
||||
pos++;
|
||||
char = text.charCodeAt(pos);
|
||||
if (char === CharacterCodes.openBrace) {
|
||||
break;
|
||||
@@ -1740,8 +1744,23 @@ namespace ts {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// FirstNonWhitespace is 0, then we only see whitespaces so far. If we see a linebreak, we want to ignore that whitespaces.
|
||||
// i.e (- : whitespace)
|
||||
// <div>----
|
||||
// </div> becomes <div></div>
|
||||
//
|
||||
// <div>----</div> becomes <div>----</div>
|
||||
if (isLineBreak(char) && firstNonWhitespace === 0) {
|
||||
firstNonWhitespace = -1;
|
||||
}
|
||||
else if (!isWhiteSpaceLike(char)) {
|
||||
firstNonWhitespace = pos;
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
return token = SyntaxKind.JsxText;
|
||||
|
||||
return firstNonWhitespace === -1 ? SyntaxKind.JsxTextAllWhiteSpaces : SyntaxKind.JsxText;
|
||||
}
|
||||
|
||||
// Scans a JSX identifier; these differ from normal identifiers in that
|
||||
|
||||
@@ -813,7 +813,7 @@ namespace ts {
|
||||
|
||||
// Create a synthetic text range for the return statement.
|
||||
const closingBraceLocation = createTokenRange(skipTrivia(currentText, node.members.end), SyntaxKind.CloseBraceToken);
|
||||
const localName = getLocalName(node);
|
||||
const localName = getInternalName(node);
|
||||
|
||||
// The following partially-emitted expression exists purely to align our sourcemap
|
||||
// emit with the original emitter.
|
||||
@@ -870,7 +870,7 @@ namespace ts {
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ undefined,
|
||||
/*asteriskToken*/ undefined,
|
||||
getDeclarationName(node),
|
||||
getInternalName(node),
|
||||
/*typeParameters*/ undefined,
|
||||
transformConstructorParameters(constructor, hasSynthesizedSuper),
|
||||
/*type*/ undefined,
|
||||
@@ -3180,7 +3180,20 @@ namespace ts {
|
||||
const savedConvertedLoopState = convertedLoopState;
|
||||
convertedLoopState = undefined;
|
||||
const ancestorFacts = enterSubtree(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes);
|
||||
const updated = visitEachChild(node, visitor, context);
|
||||
let updated: AccessorDeclaration;
|
||||
if (node.transformFlags & TransformFlags.ContainsCapturedLexicalThis) {
|
||||
const parameters = visitParameterList(node.parameters, visitor, context);
|
||||
const body = transformFunctionBody(node);
|
||||
if (node.kind === SyntaxKind.GetAccessor) {
|
||||
updated = updateGetAccessor(node, node.decorators, node.modifiers, node.name, parameters, node.type, body);
|
||||
}
|
||||
else {
|
||||
updated = updateSetAccessor(node, node.decorators, node.modifiers, node.name, parameters, body);
|
||||
}
|
||||
}
|
||||
else {
|
||||
updated = visitEachChild(node, visitor, context);
|
||||
}
|
||||
exitSubtree(ancestorFacts, HierarchyFacts.PropagateNewTargetMask, HierarchyFacts.None);
|
||||
convertedLoopState = savedConvertedLoopState;
|
||||
return updated;
|
||||
@@ -3712,7 +3725,7 @@ namespace ts {
|
||||
function substituteIdentifier(node: Identifier) {
|
||||
// Only substitute the identifier if we have enabled substitutions for block-scoped
|
||||
// bindings.
|
||||
if (enabledSubstitutions & ES2015SubstitutionFlags.BlockScopedBindings) {
|
||||
if (enabledSubstitutions & ES2015SubstitutionFlags.BlockScopedBindings && !isInternalName(node)) {
|
||||
const original = getParseTreeNode(node, isIdentifier);
|
||||
if (original && isNameOfDeclarationWithCollidingName(original)) {
|
||||
return setTextRange(getGeneratedNameForNode(original), node);
|
||||
@@ -3765,9 +3778,9 @@ namespace ts {
|
||||
* @param node An Identifier node.
|
||||
*/
|
||||
function substituteExpressionIdentifier(node: Identifier): Identifier {
|
||||
if (enabledSubstitutions & ES2015SubstitutionFlags.BlockScopedBindings) {
|
||||
if (enabledSubstitutions & ES2015SubstitutionFlags.BlockScopedBindings && !isInternalName(node)) {
|
||||
const declaration = resolver.getReferencedDeclarationWithCollidingName(node);
|
||||
if (declaration) {
|
||||
if (declaration && !(isClassLike(declaration) && isPartOfClassBody(declaration, node))) {
|
||||
return setTextRange(getGeneratedNameForNode(declaration.name), node);
|
||||
}
|
||||
}
|
||||
@@ -3775,6 +3788,32 @@ namespace ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
function isPartOfClassBody(declaration: ClassLikeDeclaration, node: Identifier) {
|
||||
let currentNode = getParseTreeNode(node);
|
||||
if (!currentNode || currentNode === declaration || currentNode.end <= declaration.pos || currentNode.pos >= declaration.end) {
|
||||
// if the node has no correlation to a parse tree node, its definitely not
|
||||
// part of the body.
|
||||
// if the node is outside of the document range of the declaration, its
|
||||
// definitely not part of the body.
|
||||
return false;
|
||||
}
|
||||
const blockScope = getEnclosingBlockScopeContainer(declaration);
|
||||
while (currentNode) {
|
||||
if (currentNode === blockScope || currentNode === declaration) {
|
||||
// if we are in the enclosing block scope of the declaration, we are definitely
|
||||
// not inside the class body.
|
||||
return false;
|
||||
}
|
||||
if (isClassElement(currentNode) && currentNode.parent === declaration) {
|
||||
// we are in the class body, but we treat static fields as outside of the class body
|
||||
return currentNode.kind !== SyntaxKind.PropertyDeclaration
|
||||
|| (getModifierFlags(currentNode) & ModifierFlags.Static) === 0;
|
||||
}
|
||||
currentNode = currentNode.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Substitutes `this` when contained within an arrow function.
|
||||
*
|
||||
@@ -3789,8 +3828,9 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getClassMemberPrefix(node: ClassExpression | ClassDeclaration, member: ClassElement) {
|
||||
const expression = getLocalName(node);
|
||||
return hasModifier(member, ModifierFlags.Static) ? expression : createPropertyAccess(expression, "prototype");
|
||||
return hasModifier(member, ModifierFlags.Static)
|
||||
? getInternalName(node)
|
||||
: createPropertyAccess(getInternalName(node), "prototype");
|
||||
}
|
||||
|
||||
function hasSynthesizedDefaultSuperCall(constructor: ConstructorDeclaration, hasExtendsClause: boolean) {
|
||||
|
||||
@@ -2601,14 +2601,16 @@ namespace ts {
|
||||
* Adds a leading VariableStatement for a enum or module declaration.
|
||||
*/
|
||||
function addVarForEnumOrModuleDeclaration(statements: Statement[], node: ModuleDeclaration | EnumDeclaration) {
|
||||
// Emit a variable statement for the module.
|
||||
// Emit a variable statement for the module. We emit top-level enums as a `var`
|
||||
// declaration to avoid static errors in global scripts scripts due to redeclaration.
|
||||
// enums in any other scope are emitted as a `let` declaration.
|
||||
const statement = createVariableStatement(
|
||||
visitNodes(node.modifiers, modifierVisitor, isModifier),
|
||||
[
|
||||
createVariableDeclarationList([
|
||||
createVariableDeclaration(
|
||||
getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)
|
||||
)
|
||||
]
|
||||
], currentScope.kind === SyntaxKind.SourceFile ? NodeFlags.None : NodeFlags.Let)
|
||||
);
|
||||
|
||||
setOriginalNode(statement, node);
|
||||
|
||||
+13
-9
@@ -10,7 +10,7 @@ namespace ts {
|
||||
|
||||
/** ES6 Map interface. */
|
||||
export interface Map<T> {
|
||||
get(key: string): T;
|
||||
get(key: string): T | undefined;
|
||||
has(key: string): boolean;
|
||||
set(key: string, value: T): this;
|
||||
delete(key: string): boolean;
|
||||
@@ -65,6 +65,7 @@ namespace ts {
|
||||
NumericLiteral,
|
||||
StringLiteral,
|
||||
JsxText,
|
||||
JsxTextAllWhiteSpaces,
|
||||
RegularExpressionLiteral,
|
||||
NoSubstitutionTemplateLiteral,
|
||||
// Pseudo-literals
|
||||
@@ -1572,6 +1573,7 @@ namespace ts {
|
||||
|
||||
export interface JsxText extends Node {
|
||||
kind: SyntaxKind.JsxText;
|
||||
containsOnlyWhiteSpaces: boolean;
|
||||
parent?: JsxElement;
|
||||
}
|
||||
|
||||
@@ -3350,6 +3352,7 @@ namespace ts {
|
||||
messageText: string | DiagnosticMessageChain;
|
||||
category: DiagnosticCategory;
|
||||
code: number;
|
||||
source?: string;
|
||||
}
|
||||
|
||||
export enum DiagnosticCategory {
|
||||
@@ -3937,14 +3940,15 @@ namespace ts {
|
||||
HelperName = 1 << 12,
|
||||
ExportName = 1 << 13, // Ensure an export prefix is added for an identifier that points to an exported declaration with a local name (see SymbolFlags.ExportHasLocal).
|
||||
LocalName = 1 << 14, // Ensure an export prefix is not added for an identifier that points to an exported declaration.
|
||||
Indented = 1 << 15, // Adds an explicit extra indentation level for class and function bodies when printing (used to match old emitter).
|
||||
NoIndentation = 1 << 16, // Do not indent the node.
|
||||
AsyncFunctionBody = 1 << 17,
|
||||
ReuseTempVariableScope = 1 << 18, // Reuse the existing temp variable scope during emit.
|
||||
CustomPrologue = 1 << 19, // Treat the statement as if it were a prologue directive (NOTE: Prologue directives are *not* transformed).
|
||||
NoHoisting = 1 << 20, // Do not hoist this declaration in --module system
|
||||
HasEndOfDeclarationMarker = 1 << 21, // Declaration has an associated NotEmittedStatement to mark the end of the declaration
|
||||
Iterator = 1 << 22, // The expression to a `yield*` should be treated as an Iterator when down-leveling, not an Iterable.
|
||||
InternalName = 1 << 15, // The name is internal to an ES5 class body function.
|
||||
Indented = 1 << 16, // Adds an explicit extra indentation level for class and function bodies when printing (used to match old emitter).
|
||||
NoIndentation = 1 << 17, // Do not indent the node.
|
||||
AsyncFunctionBody = 1 << 18,
|
||||
ReuseTempVariableScope = 1 << 19, // Reuse the existing temp variable scope during emit.
|
||||
CustomPrologue = 1 << 20, // Treat the statement as if it were a prologue directive (NOTE: Prologue directives are *not* transformed).
|
||||
NoHoisting = 1 << 21, // Do not hoist this declaration in --module system
|
||||
HasEndOfDeclarationMarker = 1 << 22, // Declaration has an associated NotEmittedStatement to mark the end of the declaration
|
||||
Iterator = 1 << 23, // The expression to a `yield*` should be treated as an Iterator when down-leveling, not an Iterable.
|
||||
}
|
||||
|
||||
export interface EmitHelper {
|
||||
|
||||
@@ -1870,7 +1870,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function getAncestor(node: Node | undefined, kind: SyntaxKind): Node {
|
||||
export function getAncestor(node: Node | undefined, kind: SyntaxKind): Node | undefined {
|
||||
while (node) {
|
||||
if (node.kind === kind) {
|
||||
return node;
|
||||
|
||||
@@ -242,31 +242,31 @@ namespace ts {
|
||||
case SyntaxKind.FunctionType:
|
||||
return updateFunctionTypeNode(<FunctionTypeNode>node,
|
||||
nodesVisitor((<FunctionTypeNode>node).typeParameters, visitor, isTypeParameter),
|
||||
visitParameterList((<FunctionTypeNode>node).parameters, visitor, context, nodesVisitor),
|
||||
nodesVisitor((<FunctionTypeNode>node).parameters, visitor, isParameterDeclaration),
|
||||
visitNode((<FunctionTypeNode>node).type, visitor, isTypeNode));
|
||||
|
||||
case SyntaxKind.ConstructorType:
|
||||
return updateConstructorTypeNode(<ConstructorTypeNode>node,
|
||||
nodesVisitor((<ConstructorTypeNode>node).typeParameters, visitor, isTypeParameter),
|
||||
visitParameterList((<ConstructorTypeNode>node).parameters, visitor, context, nodesVisitor),
|
||||
nodesVisitor((<ConstructorTypeNode>node).parameters, visitor, isParameterDeclaration),
|
||||
visitNode((<ConstructorTypeNode>node).type, visitor, isTypeNode));
|
||||
|
||||
case SyntaxKind.CallSignature:
|
||||
return updateCallSignatureDeclaration(<CallSignatureDeclaration>node,
|
||||
nodesVisitor((<CallSignatureDeclaration>node).typeParameters, visitor, isTypeParameter),
|
||||
visitParameterList((<CallSignatureDeclaration>node).parameters, visitor, context, nodesVisitor),
|
||||
nodesVisitor((<CallSignatureDeclaration>node).parameters, visitor, isParameterDeclaration),
|
||||
visitNode((<CallSignatureDeclaration>node).type, visitor, isTypeNode));
|
||||
|
||||
case SyntaxKind.ConstructSignature:
|
||||
return updateConstructSignatureDeclaration(<ConstructSignatureDeclaration>node,
|
||||
nodesVisitor((<ConstructSignatureDeclaration>node).typeParameters, visitor, isTypeParameter),
|
||||
visitParameterList((<ConstructSignatureDeclaration>node).parameters, visitor, context, nodesVisitor),
|
||||
nodesVisitor((<ConstructSignatureDeclaration>node).parameters, visitor, isParameterDeclaration),
|
||||
visitNode((<ConstructSignatureDeclaration>node).type, visitor, isTypeNode));
|
||||
|
||||
case SyntaxKind.MethodSignature:
|
||||
return updateMethodSignature(<MethodSignature>node,
|
||||
nodesVisitor((<MethodSignature>node).typeParameters, visitor, isTypeParameter),
|
||||
visitParameterList((<MethodSignature>node).parameters, visitor, context, nodesVisitor),
|
||||
nodesVisitor((<MethodSignature>node).parameters, visitor, isParameterDeclaration),
|
||||
visitNode((<MethodSignature>node).type, visitor, isTypeNode),
|
||||
visitNode((<MethodSignature>node).name, visitor, isPropertyName),
|
||||
visitNode((<MethodSignature>node).questionToken, tokenVisitor, isToken));
|
||||
@@ -275,7 +275,7 @@ namespace ts {
|
||||
return updateIndexSignatureDeclaration(<IndexSignatureDeclaration>node,
|
||||
nodesVisitor((<IndexSignatureDeclaration>node).decorators, visitor, isDecorator),
|
||||
nodesVisitor((<IndexSignatureDeclaration>node).modifiers, visitor, isModifier),
|
||||
visitParameterList((<IndexSignatureDeclaration>node).parameters, visitor, context, nodesVisitor),
|
||||
nodesVisitor((<IndexSignatureDeclaration>node).parameters, visitor, isParameterDeclaration),
|
||||
visitNode((<IndexSignatureDeclaration>node).type, visitor, isTypeNode));
|
||||
|
||||
case SyntaxKind.Parameter:
|
||||
@@ -322,7 +322,8 @@ namespace ts {
|
||||
nodesVisitor((<UnionOrIntersectionTypeNode>node).types, visitor, isTypeNode));
|
||||
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
throw Debug.fail("not implemented.");
|
||||
return updateParenthesizedType(<ParenthesizedTypeNode>node,
|
||||
visitNode((<ParenthesizedTypeNode>node).type, visitor, isTypeNode));
|
||||
|
||||
case SyntaxKind.TypeOperator:
|
||||
return updateTypeOperatorNode(<TypeOperatorNode>node, visitNode((<TypeOperatorNode>node).type, visitor, isTypeNode));
|
||||
|
||||
@@ -3,41 +3,74 @@
|
||||
|
||||
namespace ts {
|
||||
describe("TransformAPI", () => {
|
||||
function transformsCorrectly(name: string, source: string, transformers: TransformerFactory<SourceFile>[]) {
|
||||
it(name, () => {
|
||||
Harness.Baseline.runBaseline(`transformApi/transformsCorrectly.${name}.js`, () => {
|
||||
const transformed = transform(createSourceFile("source.ts", source, ScriptTarget.ES2015), transformers);
|
||||
const printer = createPrinter({ newLine: NewLineKind.CarriageReturnLineFeed }, {
|
||||
onEmitNode: transformed.emitNodeWithNotification,
|
||||
substituteNode: transformed.substituteNode
|
||||
});
|
||||
const result = printer.printBundle(createBundle(transformed.transformed));
|
||||
transformed.dispose();
|
||||
return result;
|
||||
});
|
||||
function replaceUndefinedWithVoid0(context: ts.TransformationContext) {
|
||||
const previousOnSubstituteNode = context.onSubstituteNode;
|
||||
context.enableSubstitution(SyntaxKind.Identifier);
|
||||
context.onSubstituteNode = (hint, node) => {
|
||||
node = previousOnSubstituteNode(hint, node);
|
||||
if (hint === EmitHint.Expression && node.kind === SyntaxKind.Identifier && (<Identifier>node).text === "undefined") {
|
||||
node = createPartiallyEmittedExpression(
|
||||
addSyntheticTrailingComment(
|
||||
setTextRange(
|
||||
createVoidZero(),
|
||||
node),
|
||||
SyntaxKind.MultiLineCommentTrivia, "undefined"));
|
||||
}
|
||||
return node;
|
||||
};
|
||||
return (file: ts.SourceFile) => file;
|
||||
}
|
||||
|
||||
function replaceIdentifiersNamedOldNameWithNewName(context: ts.TransformationContext) {
|
||||
const previousOnSubstituteNode = context.onSubstituteNode;
|
||||
context.enableSubstitution(SyntaxKind.Identifier);
|
||||
context.onSubstituteNode = (hint, node) => {
|
||||
node = previousOnSubstituteNode(hint, node);
|
||||
if (node.kind === SyntaxKind.Identifier && (<Identifier>node).text === "oldName") {
|
||||
node = setTextRange(createIdentifier("newName"), node);
|
||||
}
|
||||
return node;
|
||||
};
|
||||
return (file: ts.SourceFile) => file;
|
||||
}
|
||||
|
||||
function transformSourceFile(sourceText: string, transformers: TransformerFactory<SourceFile>[]) {
|
||||
const transformed = transform(createSourceFile("source.ts", sourceText, ScriptTarget.ES2015), transformers);
|
||||
const printer = createPrinter({ newLine: NewLineKind.CarriageReturnLineFeed }, {
|
||||
onEmitNode: transformed.emitNodeWithNotification,
|
||||
substituteNode: transformed.substituteNode
|
||||
});
|
||||
const result = printer.printBundle(createBundle(transformed.transformed));
|
||||
transformed.dispose();
|
||||
return result;
|
||||
}
|
||||
|
||||
function testBaseline(testName: string, test: () => string) {
|
||||
it(testName, () => {
|
||||
Harness.Baseline.runBaseline(`transformApi/transformsCorrectly.${testName}.js`, test);
|
||||
});
|
||||
}
|
||||
|
||||
transformsCorrectly("substitution", `
|
||||
var a = undefined;
|
||||
`, [
|
||||
context => {
|
||||
const previousOnSubstituteNode = context.onSubstituteNode;
|
||||
context.enableSubstitution(SyntaxKind.Identifier);
|
||||
context.onSubstituteNode = (hint, node) => {
|
||||
node = previousOnSubstituteNode(hint, node);
|
||||
if (hint === EmitHint.Expression && node.kind === SyntaxKind.Identifier && (<Identifier>node).text === "undefined") {
|
||||
node = createPartiallyEmittedExpression(
|
||||
addSyntheticTrailingComment(
|
||||
setTextRange(
|
||||
createVoidZero(),
|
||||
node),
|
||||
SyntaxKind.MultiLineCommentTrivia, "undefined"));
|
||||
}
|
||||
return node;
|
||||
};
|
||||
return file => file;
|
||||
}
|
||||
]);
|
||||
testBaseline("substitution", () => {
|
||||
return transformSourceFile(`var a = undefined;`, [replaceUndefinedWithVoid0]);
|
||||
});
|
||||
|
||||
testBaseline("types", () => {
|
||||
return transformSourceFile(`let a: () => void`, [
|
||||
context => file => visitNode(file, function visitor(node: Node): VisitResult<Node> {
|
||||
return visitEachChild(node, visitor, context);
|
||||
})
|
||||
]);
|
||||
});
|
||||
|
||||
testBaseline("fromTranspileModule", () => {
|
||||
return ts.transpileModule(`var oldName = undefined;`, {
|
||||
transformers: {
|
||||
before: [replaceUndefinedWithVoid0],
|
||||
after: [replaceIdentifiersNamedOldNameWithNewName]
|
||||
}
|
||||
}).outputText;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -3204,6 +3204,122 @@ namespace ts.projectSystem {
|
||||
const errorResult = <protocol.Diagnostic[]>session.executeCommand(dTsFileGetErrRequest).response;
|
||||
assert.isTrue(errorResult.length === 0);
|
||||
});
|
||||
|
||||
it("should not report bind errors for declaration files with skipLibCheck=true", () => {
|
||||
const jsconfigFile = {
|
||||
path: "/a/jsconfig.json",
|
||||
content: "{}"
|
||||
};
|
||||
const jsFile = {
|
||||
path: "/a/jsFile.js",
|
||||
content: "let x = 1;"
|
||||
};
|
||||
const dTsFile1 = {
|
||||
path: "/a/dTsFile1.d.ts",
|
||||
content: `
|
||||
declare var x: number;`
|
||||
};
|
||||
const dTsFile2 = {
|
||||
path: "/a/dTsFile2.d.ts",
|
||||
content: `
|
||||
declare var x: string;`
|
||||
};
|
||||
const host = createServerHost([jsconfigFile, jsFile, dTsFile1, dTsFile2]);
|
||||
const session = createSession(host);
|
||||
openFilesForSession([jsFile], session);
|
||||
|
||||
const dTsFile1GetErrRequest = makeSessionRequest<protocol.SemanticDiagnosticsSyncRequestArgs>(
|
||||
CommandNames.SemanticDiagnosticsSync,
|
||||
{ file: dTsFile1.path }
|
||||
);
|
||||
const error1Result = <protocol.Diagnostic[]>session.executeCommand(dTsFile1GetErrRequest).response;
|
||||
assert.isTrue(error1Result.length === 0);
|
||||
|
||||
const dTsFile2GetErrRequest = makeSessionRequest<protocol.SemanticDiagnosticsSyncRequestArgs>(
|
||||
CommandNames.SemanticDiagnosticsSync,
|
||||
{ file: dTsFile2.path }
|
||||
);
|
||||
const error2Result = <protocol.Diagnostic[]>session.executeCommand(dTsFile2GetErrRequest).response;
|
||||
assert.isTrue(error2Result.length === 0);
|
||||
});
|
||||
|
||||
it("should report semanitc errors for loose JS files with '// @ts-check' and skipLibCheck=true", () => {
|
||||
const jsFile = {
|
||||
path: "/a/jsFile.js",
|
||||
content: `
|
||||
// @ts-check
|
||||
let x = 1;
|
||||
x === "string";`
|
||||
};
|
||||
|
||||
const host = createServerHost([jsFile]);
|
||||
const session = createSession(host);
|
||||
openFilesForSession([jsFile], session);
|
||||
|
||||
const getErrRequest = makeSessionRequest<protocol.SemanticDiagnosticsSyncRequestArgs>(
|
||||
CommandNames.SemanticDiagnosticsSync,
|
||||
{ file: jsFile.path }
|
||||
);
|
||||
const errorResult = <protocol.Diagnostic[]>session.executeCommand(getErrRequest).response;
|
||||
assert.isTrue(errorResult.length === 1);
|
||||
assert.equal(errorResult[0].code, Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2.code);
|
||||
});
|
||||
|
||||
it("should report semanitc errors for configured js project with '// @ts-check' and skipLibCheck=true", () => {
|
||||
const jsconfigFile = {
|
||||
path: "/a/jsconfig.json",
|
||||
content: "{}"
|
||||
};
|
||||
|
||||
const jsFile = {
|
||||
path: "/a/jsFile.js",
|
||||
content: `
|
||||
// @ts-check
|
||||
let x = 1;
|
||||
x === "string";`
|
||||
};
|
||||
|
||||
const host = createServerHost([jsconfigFile, jsFile]);
|
||||
const session = createSession(host);
|
||||
openFilesForSession([jsFile], session);
|
||||
|
||||
const getErrRequest = makeSessionRequest<protocol.SemanticDiagnosticsSyncRequestArgs>(
|
||||
CommandNames.SemanticDiagnosticsSync,
|
||||
{ file: jsFile.path }
|
||||
);
|
||||
const errorResult = <protocol.Diagnostic[]>session.executeCommand(getErrRequest).response;
|
||||
assert.isTrue(errorResult.length === 1);
|
||||
assert.equal(errorResult[0].code, Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2.code);
|
||||
});
|
||||
|
||||
it("should report semanitc errors for configured js project with checkJs=true and skipLibCheck=true", () => {
|
||||
const jsconfigFile = {
|
||||
path: "/a/jsconfig.json",
|
||||
content: JSON.stringify({
|
||||
compilerOptions: {
|
||||
checkJs: true,
|
||||
skipLibCheck: true
|
||||
},
|
||||
})
|
||||
};
|
||||
const jsFile = {
|
||||
path: "/a/jsFile.js",
|
||||
content: `let x = 1;
|
||||
x === "string";`
|
||||
};
|
||||
|
||||
const host = createServerHost([jsconfigFile, jsFile]);
|
||||
const session = createSession(host);
|
||||
openFilesForSession([jsFile], session);
|
||||
|
||||
const getErrRequest = makeSessionRequest<protocol.SemanticDiagnosticsSyncRequestArgs>(
|
||||
CommandNames.SemanticDiagnosticsSync,
|
||||
{ file: jsFile.path }
|
||||
);
|
||||
const errorResult = <protocol.Diagnostic[]>session.executeCommand(getErrRequest).response;
|
||||
assert.isTrue(errorResult.length === 1);
|
||||
assert.equal(errorResult[0].code, Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2.code);
|
||||
});
|
||||
});
|
||||
|
||||
describe("non-existing directories listed in config file input array", () => {
|
||||
|
||||
Vendored
+35
@@ -21,6 +21,22 @@ interface FormData {
|
||||
[Symbol.iterator](): IterableIterator<string | File>;
|
||||
}
|
||||
|
||||
interface Headers {
|
||||
[Symbol.iterator](): IterableIterator<[string, string]>;
|
||||
/**
|
||||
* Returns an iterator allowing to go through all key/value pairs contained in this object.
|
||||
*/
|
||||
entries(): IterableIterator<[string, string]>;
|
||||
/**
|
||||
* Returns an iterator allowing to go through all keys f the key/value pairs contained in this object.
|
||||
*/
|
||||
keys(): IterableIterator<string>;
|
||||
/**
|
||||
* Returns an iterator allowing to go through all values of the key/value pairs contained in this object.
|
||||
*/
|
||||
values(): IterableIterator<string>;
|
||||
}
|
||||
|
||||
interface NodeList {
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the list
|
||||
@@ -70,3 +86,22 @@ interface NodeListOf<TNode extends Node> {
|
||||
|
||||
[Symbol.iterator](): IterableIterator<TNode>;
|
||||
}
|
||||
|
||||
interface URLSearchParams {
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the search params
|
||||
*/
|
||||
entries(): IterableIterator<[string, string]>;
|
||||
/**
|
||||
* Returns a list of keys in the search params
|
||||
*/
|
||||
keys(): IterableIterator<string>;
|
||||
/**
|
||||
* Returns a list of values in the search params
|
||||
*/
|
||||
values(): IterableIterator<string>;
|
||||
/**
|
||||
* iterate over key/value pairs
|
||||
*/
|
||||
[Symbol.iterator](): IterableIterator<[string, string]>;
|
||||
}
|
||||
|
||||
Vendored
+71
-7
@@ -32,17 +32,17 @@ interface Array<T> {
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
* Returns an iterable of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, T]>;
|
||||
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
* Returns an iterable of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
* Returns an iterable of values in the array
|
||||
*/
|
||||
values(): IterableIterator<T>;
|
||||
}
|
||||
@@ -66,21 +66,21 @@ interface ArrayConstructor {
|
||||
}
|
||||
|
||||
interface ReadonlyArray<T> {
|
||||
/** Iterator */
|
||||
/** Iterator of values in the array. */
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
* Returns an iterable of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, T]>;
|
||||
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
* Returns an iterable of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
* Returns an iterable of values in the array
|
||||
*/
|
||||
values(): IterableIterator<T>;
|
||||
}
|
||||
@@ -91,9 +91,42 @@ interface IArguments {
|
||||
}
|
||||
|
||||
interface Map<K, V> {
|
||||
/** Returns an iterable of entries in the map. */
|
||||
[Symbol.iterator](): IterableIterator<[K, V]>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of key, value pairs for every entry in the map.
|
||||
*/
|
||||
entries(): IterableIterator<[K, V]>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of keys in the map
|
||||
*/
|
||||
keys(): IterableIterator<K>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of values in the map
|
||||
*/
|
||||
values(): IterableIterator<V>;
|
||||
}
|
||||
|
||||
interface ReadonlyMap<K, V> {
|
||||
/** Returns an iterable of entries in the map. */
|
||||
[Symbol.iterator](): IterableIterator<[K, V]>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of key, value pairs for every entry in the map.
|
||||
*/
|
||||
entries(): IterableIterator<[K, V]>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of keys in the map
|
||||
*/
|
||||
keys(): IterableIterator<K>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of values in the map
|
||||
*/
|
||||
values(): IterableIterator<V>;
|
||||
}
|
||||
|
||||
@@ -108,9 +141,40 @@ interface WeakMapConstructor {
|
||||
}
|
||||
|
||||
interface Set<T> {
|
||||
/** Iterates over values in the set. */
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
/**
|
||||
* Returns an iterable of [v,v] pairs for every value `v` in the set.
|
||||
*/
|
||||
entries(): IterableIterator<[T, T]>;
|
||||
/**
|
||||
* Despite its name, returns an iterable of the values in the set,
|
||||
*/
|
||||
keys(): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of values in the set.
|
||||
*/
|
||||
values(): IterableIterator<T>;
|
||||
}
|
||||
|
||||
interface ReadonlySet<T> {
|
||||
/** Iterates over values in the set. */
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of [v,v] pairs for every value `v` in the set.
|
||||
*/
|
||||
entries(): IterableIterator<[T, T]>;
|
||||
|
||||
/**
|
||||
* Despite its name, returns an iterable of the values in the set,
|
||||
*/
|
||||
keys(): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of values in the set.
|
||||
*/
|
||||
values(): IterableIterator<T>;
|
||||
}
|
||||
|
||||
|
||||
@@ -1824,10 +1824,20 @@ namespace ts.server.protocol {
|
||||
*/
|
||||
text: string;
|
||||
|
||||
/**
|
||||
* The category of the diagnostic message, e.g. "error" vs. "warning"
|
||||
*/
|
||||
category: string;
|
||||
|
||||
/**
|
||||
* The error code of the diagnostic message.
|
||||
*/
|
||||
code?: number;
|
||||
|
||||
/**
|
||||
* The name of the plugin reporting the message.
|
||||
*/
|
||||
source?: string;
|
||||
}
|
||||
|
||||
export interface DiagnosticEventBody {
|
||||
@@ -2267,15 +2277,19 @@ namespace ts.server.protocol {
|
||||
allowSyntheticDefaultImports?: boolean;
|
||||
allowUnreachableCode?: boolean;
|
||||
allowUnusedLabels?: boolean;
|
||||
alwaysStrict?: boolean;
|
||||
baseUrl?: string;
|
||||
charset?: string;
|
||||
checkJs?: boolean;
|
||||
declaration?: boolean;
|
||||
declarationDir?: string;
|
||||
disableSizeLimit?: boolean;
|
||||
downlevelIteration?: boolean;
|
||||
emitBOM?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
experimentalDecorators?: boolean;
|
||||
forceConsistentCasingInFileNames?: boolean;
|
||||
importHelpers?: boolean;
|
||||
inlineSourceMap?: boolean;
|
||||
inlineSources?: boolean;
|
||||
isolatedModules?: boolean;
|
||||
@@ -2315,6 +2329,7 @@ namespace ts.server.protocol {
|
||||
skipDefaultLibCheck?: boolean;
|
||||
sourceMap?: boolean;
|
||||
sourceRoot?: string;
|
||||
strict?: boolean;
|
||||
strictNullChecks?: boolean;
|
||||
suppressExcessPropertyErrors?: boolean;
|
||||
suppressImplicitAnyIndexErrors?: boolean;
|
||||
|
||||
+28
-12
@@ -25,15 +25,26 @@ namespace ts.server {
|
||||
return ((1e9 * seconds) + nanoseconds) / 1000000.0;
|
||||
}
|
||||
|
||||
function shouldSkipSemanticCheck(project: Project) {
|
||||
if (project.projectKind === ProjectKind.Inferred || project.projectKind === ProjectKind.External) {
|
||||
return project.isJsOnlyProject();
|
||||
}
|
||||
else {
|
||||
// For configured projects, require that skipLibCheck be set also
|
||||
const options = project.getCompilerOptions();
|
||||
return options.skipLibCheck && !options.checkJs && project.isJsOnlyProject();
|
||||
function isDeclarationFileInJSOnlyNonConfiguredProject(project: Project, file: NormalizedPath) {
|
||||
// Checking for semantic diagnostics is an expensive process. We want to avoid it if we
|
||||
// know for sure it is not needed.
|
||||
// For instance, .d.ts files injected by ATA automatically do not produce any relevant
|
||||
// errors to a JS- only project.
|
||||
//
|
||||
// Note that configured projects can set skipLibCheck (on by default in jsconfig.json) to
|
||||
// disable checking for declaration files. We only need to verify for inferred projects (e.g.
|
||||
// miscellaneous context in VS) and external projects(e.g.VS.csproj project) with only JS
|
||||
// files.
|
||||
//
|
||||
// We still want to check .js files in a JS-only inferred or external project (e.g. if the
|
||||
// file has '// @ts-check').
|
||||
|
||||
if ((project.projectKind === ProjectKind.Inferred || project.projectKind === ProjectKind.External) &&
|
||||
project.isJsOnlyProject()) {
|
||||
const scriptInfo = project.getScriptInfoForNormalizedPath(file);
|
||||
return scriptInfo && !scriptInfo.isJavaScript();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
interface FileStart {
|
||||
@@ -67,7 +78,9 @@ namespace ts.server {
|
||||
start: scriptInfo.positionToLineOffset(diag.start),
|
||||
end: scriptInfo.positionToLineOffset(diag.start + diag.length),
|
||||
text: ts.flattenDiagnosticMessageText(diag.messageText, "\n"),
|
||||
code: diag.code
|
||||
code: diag.code,
|
||||
category: DiagnosticCategory[diag.category].toLowerCase(),
|
||||
source: diag.source
|
||||
};
|
||||
}
|
||||
|
||||
@@ -75,7 +88,9 @@ namespace ts.server {
|
||||
return {
|
||||
start: undefined,
|
||||
end: undefined,
|
||||
text: ts.flattenDiagnosticMessageText(diag.messageText, "\n")
|
||||
text: ts.flattenDiagnosticMessageText(diag.messageText, "\n"),
|
||||
category: DiagnosticCategory[diag.category].toLowerCase(),
|
||||
source: diag.source
|
||||
};
|
||||
}
|
||||
|
||||
@@ -489,7 +504,7 @@ namespace ts.server {
|
||||
private semanticCheck(file: NormalizedPath, project: Project) {
|
||||
try {
|
||||
let diags: Diagnostic[] = [];
|
||||
if (!shouldSkipSemanticCheck(project)) {
|
||||
if (!isDeclarationFileInJSOnlyNonConfiguredProject(project, file)) {
|
||||
diags = project.getLanguageService().getSemanticDiagnostics(file);
|
||||
}
|
||||
|
||||
@@ -590,6 +605,7 @@ namespace ts.server {
|
||||
length: d.length,
|
||||
category: DiagnosticCategory[d.category].toLowerCase(),
|
||||
code: d.code,
|
||||
source: d.source,
|
||||
startLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start),
|
||||
endLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start + d.length)
|
||||
});
|
||||
@@ -597,7 +613,7 @@ namespace ts.server {
|
||||
|
||||
private getDiagnosticsWorker(args: protocol.FileRequestArgs, isSemantic: boolean, selector: (project: Project, file: string) => Diagnostic[], includeLinePosition: boolean) {
|
||||
const { project, file } = this.getFileAndProject(args);
|
||||
if (isSemantic && shouldSkipSemanticCheck(project)) {
|
||||
if (isSemantic && isDeclarationFileInJSOnlyNonConfiguredProject(project, file)) {
|
||||
return [];
|
||||
}
|
||||
const scriptInfo = project.getScriptInfoForNormalizedPath(file);
|
||||
|
||||
@@ -362,7 +362,7 @@ namespace ts.formatting {
|
||||
sourceFile: SourceFileLike): TextChange[] {
|
||||
|
||||
// formatting context is used by rules provider
|
||||
const formattingContext = new FormattingContext(sourceFile, requestKind);
|
||||
const formattingContext = new FormattingContext(sourceFile, requestKind, options);
|
||||
let previousRangeHasError: boolean;
|
||||
let previousRange: TextRangeWithKind;
|
||||
let previousParent: Node;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace ts.formatting {
|
||||
private contextNodeBlockIsOnOneLine: boolean;
|
||||
private nextNodeBlockIsOnOneLine: boolean;
|
||||
|
||||
constructor(public readonly sourceFile: SourceFileLike, public formattingRequestKind: FormattingRequestKind) {
|
||||
constructor(public readonly sourceFile: SourceFileLike, public formattingRequestKind: FormattingRequestKind, public options: ts.FormatCodeSettings) {
|
||||
}
|
||||
|
||||
public updateContext(currentRange: TextRangeWithKind, currentTokenParent: Node, nextRange: TextRangeWithKind, nextTokenParent: Node, commonParent: Node) {
|
||||
|
||||
@@ -12,12 +12,11 @@ namespace ts.formatting {
|
||||
|
||||
static Any: RuleOperationContext = new RuleOperationContext();
|
||||
|
||||
|
||||
public IsAny(): boolean {
|
||||
return this === RuleOperationContext.Any;
|
||||
}
|
||||
|
||||
public InContext(context: FormattingContext): boolean {
|
||||
public InContext(context: FormattingContext): boolean {
|
||||
if (this.IsAny()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -147,6 +147,9 @@ namespace ts.formatting {
|
||||
// These rules are higher in priority than user-configurable rules.
|
||||
public HighPriorityCommonRules: Rule[];
|
||||
|
||||
// These rules are applied after high priority rules.
|
||||
public UserConfigurableRules: Rule[];
|
||||
|
||||
// These rules are lower in priority than user-configurable rules.
|
||||
public LowPriorityCommonRules: Rule[];
|
||||
|
||||
@@ -295,10 +298,10 @@ namespace ts.formatting {
|
||||
this.SpaceBeforeOpenBraceInControl = new Rule(RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines);
|
||||
|
||||
// Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}.
|
||||
this.SpaceAfterOpenBrace = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsBraceWrappedContext), RuleAction.Space));
|
||||
this.SpaceBeforeCloseBrace = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsBraceWrappedContext), RuleAction.Space));
|
||||
this.NoSpaceAfterOpenBrace = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseBrace = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceAfterOpenBrace = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), Rules.IsBraceWrappedContext), RuleAction.Space));
|
||||
this.SpaceBeforeCloseBrace = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), Rules.IsBraceWrappedContext), RuleAction.Space));
|
||||
this.NoSpaceAfterOpenBrace = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseBrace = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBetweenEmptyBraceBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), RuleAction.Delete));
|
||||
|
||||
// Insert new line after { and before } in multi-line contexts.
|
||||
@@ -334,8 +337,8 @@ namespace ts.formatting {
|
||||
this.SpaceAfterLetConstInVariableDeclaration = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.LetKeyword, SyntaxKind.ConstKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), RuleAction.Space));
|
||||
this.NoSpaceBeforeOpenParenInFuncCall = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), RuleAction.Delete));
|
||||
this.SpaceAfterFunctionInFuncDecl = new Rule(RuleDescriptor.create3(SyntaxKind.FunctionKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Space));
|
||||
this.SpaceBeforeOpenParenInFuncDecl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeOpenParenInFuncDecl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), RuleAction.Delete));
|
||||
this.SpaceBeforeOpenParenInFuncDecl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("insertSpaceBeforeFunctionParenthesis"), Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeOpenParenInFuncDecl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceBeforeFunctionParenthesis"), Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), RuleAction.Delete));
|
||||
this.SpaceAfterVoidOperator = new Rule(RuleDescriptor.create3(SyntaxKind.VoidKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), RuleAction.Space));
|
||||
|
||||
this.NoSpaceBetweenReturnAndSemicolon = new Rule(RuleDescriptor.create1(SyntaxKind.ReturnKeyword, SyntaxKind.SemicolonToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
@@ -357,9 +360,8 @@ namespace ts.formatting {
|
||||
|
||||
// TypeScript-specific higher priority rules
|
||||
|
||||
// Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses
|
||||
this.SpaceAfterConstructor = new Rule(RuleDescriptor.create1(SyntaxKind.ConstructorKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceAfterConstructor = new Rule(RuleDescriptor.create1(SyntaxKind.ConstructorKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceAfterConstructor = new Rule(RuleDescriptor.create1(SyntaxKind.ConstructorKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("insertSpaceAfterConstructor"), Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceAfterConstructor = new Rule(RuleDescriptor.create1(SyntaxKind.ConstructorKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceAfterConstructor"), Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Use of module as a function call. e.g.: import m2 = module("m2");
|
||||
this.NoSpaceAfterModuleImport = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.ModuleKeyword, SyntaxKind.RequireKeyword]), SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
@@ -416,6 +418,72 @@ namespace ts.formatting {
|
||||
// No space before non-null assertion operator
|
||||
this.NoSpaceBeforeNonNullAssertionOperator = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.ExclamationToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonNullAssertionContext), RuleAction.Delete));
|
||||
|
||||
///
|
||||
/// Rules controlled by user options
|
||||
///
|
||||
|
||||
// Insert space after comma delimiter
|
||||
this.SpaceAfterComma = new Rule(RuleDescriptor.create3(SyntaxKind.CommaToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("insertSpaceAfterCommaDelimiter"), Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNextTokenNotCloseBracket), RuleAction.Space));
|
||||
this.NoSpaceAfterComma = new Rule(RuleDescriptor.create3(SyntaxKind.CommaToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext), RuleAction.Delete));
|
||||
|
||||
// Insert space before and after binary operators
|
||||
this.SpaceBeforeBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.BinaryOperators), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("insertSpaceBeforeAndAfterBinaryOperators"), Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.BinaryOperators, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("insertSpaceBeforeAndAfterBinaryOperators"), Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.BinaryOperators), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceBeforeAndAfterBinaryOperators"), Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.BinaryOperators, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceBeforeAndAfterBinaryOperators"), Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Delete));
|
||||
|
||||
// Insert space after keywords in control flow statements
|
||||
this.SpaceAfterKeywordInControl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Keywords, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("insertSpaceAfterKeywordsInControlFlowStatements"), Rules.IsControlDeclContext), RuleAction.Space));
|
||||
this.NoSpaceAfterKeywordInControl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Keywords, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceAfterKeywordsInControlFlowStatements"), Rules.IsControlDeclContext), RuleAction.Delete));
|
||||
|
||||
// Open Brace braces after function
|
||||
// TypeScript: Function can have return types, which can be made of tons of different token kinds
|
||||
this.NewLineBeforeOpenBraceInFunction = new Rule(RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("placeOpenBraceOnNewLineForFunctions"), Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), RuleAction.NewLine), RuleFlags.CanDeleteNewLines);
|
||||
|
||||
// Open Brace braces after TypeScript module/class/interface
|
||||
this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new Rule(RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("placeOpenBraceOnNewLineForFunctions"), Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), RuleAction.NewLine), RuleFlags.CanDeleteNewLines);
|
||||
|
||||
// Open Brace braces after control block
|
||||
this.NewLineBeforeOpenBraceInControl = new Rule(RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("placeOpenBraceOnNewLineForControlBlocks"), Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), RuleAction.NewLine), RuleFlags.CanDeleteNewLines);
|
||||
|
||||
// Insert space after semicolon in for statement
|
||||
this.SpaceAfterSemicolonInFor = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("insertSpaceAfterSemicolonInForStatements"), Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), RuleAction.Space));
|
||||
this.NoSpaceAfterSemicolonInFor = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceAfterSemicolonInForStatements"), Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), RuleAction.Delete));
|
||||
|
||||
// Insert space after opening and before closing nonempty parenthesis
|
||||
this.SpaceAfterOpenParen = new Rule(RuleDescriptor.create3(SyntaxKind.OpenParenToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBeforeCloseParen = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBetweenParens = new Rule(RuleDescriptor.create1(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOpenParen = new Rule(RuleDescriptor.create3(SyntaxKind.OpenParenToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseParen = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Insert space after opening and before closing nonempty brackets
|
||||
this.SpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBetweenBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Insert space after opening and before closing template string braces
|
||||
this.NoSpaceAfterTemplateHeadAndMiddle = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.TemplateHead, SyntaxKind.TemplateMiddle]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceAfterTemplateHeadAndMiddle = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.TemplateHead, SyntaxKind.TemplateMiddle]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeTemplateMiddleAndTail = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.TemplateMiddle, SyntaxKind.TemplateTail])), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceBeforeTemplateMiddleAndTail = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.TemplateMiddle, SyntaxKind.TemplateTail])), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
|
||||
// No space after { and before } in JSX expression
|
||||
this.NoSpaceAfterOpenBraceInJsxExpression = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), RuleAction.Delete));
|
||||
this.SpaceAfterOpenBraceInJsxExpression = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeCloseBraceInJsxExpression = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), RuleAction.Delete));
|
||||
this.SpaceBeforeCloseBraceInJsxExpression = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), RuleAction.Space));
|
||||
|
||||
// Insert space after function keyword for anonymous functions
|
||||
this.SpaceAfterAnonymousFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), Rules.IsFunctionDeclContext), RuleAction.Space));
|
||||
this.NoSpaceAfterAnonymousFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), Rules.IsFunctionDeclContext), RuleAction.Delete));
|
||||
|
||||
// No space after type assertion
|
||||
this.NoSpaceAfterTypeAssertion = new Rule(RuleDescriptor.create3(SyntaxKind.GreaterThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceAfterTypeAssertion"), Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), RuleAction.Delete));
|
||||
this.SpaceAfterTypeAssertion = new Rule(RuleDescriptor.create3(SyntaxKind.GreaterThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabled("insertSpaceAfterTypeAssertion"), Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), RuleAction.Space));
|
||||
|
||||
// These rules are higher in priority than user-configurable rules.
|
||||
this.HighPriorityCommonRules = [
|
||||
this.IgnoreBeforeComment, this.IgnoreAfterLineComment,
|
||||
@@ -465,6 +533,25 @@ namespace ts.formatting {
|
||||
this.NoSpaceBeforeNonNullAssertionOperator
|
||||
];
|
||||
|
||||
// These rules are applied after high priority rules.
|
||||
this.UserConfigurableRules = [
|
||||
this.SpaceAfterConstructor, this.NoSpaceAfterConstructor,
|
||||
this.SpaceAfterComma, this.NoSpaceAfterComma,
|
||||
this.SpaceAfterAnonymousFunctionKeyword, this.NoSpaceAfterAnonymousFunctionKeyword,
|
||||
this.SpaceAfterKeywordInControl, this.NoSpaceAfterKeywordInControl,
|
||||
this.SpaceAfterOpenParen, this.SpaceBeforeCloseParen, this.NoSpaceBetweenParens, this.NoSpaceAfterOpenParen, this.NoSpaceBeforeCloseParen,
|
||||
this.SpaceAfterOpenBracket, this.SpaceBeforeCloseBracket, this.NoSpaceBetweenBrackets, this.NoSpaceAfterOpenBracket, this.NoSpaceBeforeCloseBracket,
|
||||
this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NoSpaceBetweenEmptyBraceBrackets, this.NoSpaceAfterOpenBrace, this.NoSpaceBeforeCloseBrace,
|
||||
this.SpaceAfterTemplateHeadAndMiddle, this.SpaceBeforeTemplateMiddleAndTail, this.NoSpaceAfterTemplateHeadAndMiddle, this.NoSpaceBeforeTemplateMiddleAndTail,
|
||||
this.SpaceAfterOpenBraceInJsxExpression, this.SpaceBeforeCloseBraceInJsxExpression, this.NoSpaceAfterOpenBraceInJsxExpression, this.NoSpaceBeforeCloseBraceInJsxExpression,
|
||||
this.SpaceAfterSemicolonInFor, this.NoSpaceAfterSemicolonInFor,
|
||||
this.SpaceBeforeBinaryOperator, this.SpaceAfterBinaryOperator, this.NoSpaceBeforeBinaryOperator, this.NoSpaceAfterBinaryOperator,
|
||||
this.SpaceBeforeOpenParenInFuncDecl, this.NoSpaceBeforeOpenParenInFuncDecl,
|
||||
this.NewLineBeforeOpenBraceInControl,
|
||||
this.NewLineBeforeOpenBraceInFunction, this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock,
|
||||
this.SpaceAfterTypeAssertion, this.NoSpaceAfterTypeAssertion
|
||||
];
|
||||
|
||||
// These rules are lower in priority than user-configurable rules.
|
||||
this.LowPriorityCommonRules = [
|
||||
this.NoSpaceBeforeSemicolon,
|
||||
@@ -475,79 +562,28 @@ namespace ts.formatting {
|
||||
this.SpaceAfterSemicolon,
|
||||
this.SpaceBetweenStatements, this.SpaceAfterTryFinally
|
||||
];
|
||||
|
||||
///
|
||||
/// Rules controlled by user options
|
||||
///
|
||||
|
||||
// Insert space after comma delimiter
|
||||
this.SpaceAfterComma = new Rule(RuleDescriptor.create3(SyntaxKind.CommaToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNextTokenNotCloseBracket), RuleAction.Space));
|
||||
this.NoSpaceAfterComma = new Rule(RuleDescriptor.create3(SyntaxKind.CommaToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext), RuleAction.Delete));
|
||||
|
||||
// Insert space before and after binary operators
|
||||
this.SpaceBeforeBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.BinaryOperators), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.SpaceAfterBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.BinaryOperators, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.BinaryOperators), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterBinaryOperator = new Rule(RuleDescriptor.create4(Shared.TokenRange.BinaryOperators, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), RuleAction.Delete));
|
||||
|
||||
// Insert space after keywords in control flow statements
|
||||
this.SpaceAfterKeywordInControl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Keywords, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsControlDeclContext), RuleAction.Space));
|
||||
this.NoSpaceAfterKeywordInControl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Keywords, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsControlDeclContext), RuleAction.Delete));
|
||||
|
||||
// Open Brace braces after function
|
||||
// TypeScript: Function can have return types, which can be made of tons of different token kinds
|
||||
this.NewLineBeforeOpenBraceInFunction = new Rule(RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), RuleAction.NewLine), RuleFlags.CanDeleteNewLines);
|
||||
|
||||
// Open Brace braces after TypeScript module/class/interface
|
||||
this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new Rule(RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), RuleAction.NewLine), RuleFlags.CanDeleteNewLines);
|
||||
|
||||
// Open Brace braces after control block
|
||||
this.NewLineBeforeOpenBraceInControl = new Rule(RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), RuleAction.NewLine), RuleFlags.CanDeleteNewLines);
|
||||
|
||||
// Insert space after semicolon in for statement
|
||||
this.SpaceAfterSemicolonInFor = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), RuleAction.Space));
|
||||
this.NoSpaceAfterSemicolonInFor = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), RuleAction.Delete));
|
||||
|
||||
// Insert space after opening and before closing nonempty parenthesis
|
||||
this.SpaceAfterOpenParen = new Rule(RuleDescriptor.create3(SyntaxKind.OpenParenToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBeforeCloseParen = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBetweenParens = new Rule(RuleDescriptor.create1(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOpenParen = new Rule(RuleDescriptor.create3(SyntaxKind.OpenParenToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseParen = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Insert space after opening and before closing nonempty brackets
|
||||
this.SpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBetweenBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Insert space after opening and before closing template string braces
|
||||
this.NoSpaceAfterTemplateHeadAndMiddle = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.TemplateHead, SyntaxKind.TemplateMiddle]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceAfterTemplateHeadAndMiddle = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.TemplateHead, SyntaxKind.TemplateMiddle]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeTemplateMiddleAndTail = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.TemplateMiddle, SyntaxKind.TemplateTail])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceBeforeTemplateMiddleAndTail = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.TemplateMiddle, SyntaxKind.TemplateTail])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
||||
|
||||
// No space after { and before } in JSX expression
|
||||
this.NoSpaceAfterOpenBraceInJsxExpression = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), RuleAction.Delete));
|
||||
this.SpaceAfterOpenBraceInJsxExpression = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeCloseBraceInJsxExpression = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), RuleAction.Delete));
|
||||
this.SpaceBeforeCloseBraceInJsxExpression = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), RuleAction.Space));
|
||||
|
||||
// Insert space after function keyword for anonymous functions
|
||||
this.SpaceAfterAnonymousFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Space));
|
||||
this.NoSpaceAfterAnonymousFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Delete));
|
||||
|
||||
// No space after type assertion
|
||||
this.NoSpaceAfterTypeAssertion = new Rule(RuleDescriptor.create3(SyntaxKind.GreaterThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), RuleAction.Delete));
|
||||
this.SpaceAfterTypeAssertion = new Rule(RuleDescriptor.create3(SyntaxKind.GreaterThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), RuleAction.Space));
|
||||
|
||||
}
|
||||
|
||||
///
|
||||
/// Contexts
|
||||
///
|
||||
|
||||
static IsOptionEnabled(optionName: keyof FormatCodeSettings): (context: FormattingContext) => boolean {
|
||||
return (context) => context.options && context.options.hasOwnProperty(optionName) && !!context.options[optionName];
|
||||
}
|
||||
|
||||
static IsOptionDisabled(optionName: keyof FormatCodeSettings): (context: FormattingContext) => boolean {
|
||||
return (context) => context.options && context.options.hasOwnProperty(optionName) && !context.options[optionName];
|
||||
}
|
||||
|
||||
static IsOptionDisabledOrUndefined(optionName: keyof FormatCodeSettings): (context: FormattingContext) => boolean {
|
||||
return (context) => !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName];
|
||||
}
|
||||
|
||||
static IsOptionEnabledOrUndefined(optionName: keyof FormatCodeSettings): (context: FormattingContext) => boolean {
|
||||
return (context) => !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName];
|
||||
}
|
||||
|
||||
static IsForContext(context: FormattingContext): boolean {
|
||||
return context.contextNode.kind === SyntaxKind.ForStatement;
|
||||
}
|
||||
|
||||
@@ -5,11 +5,12 @@ namespace ts.formatting {
|
||||
export class RulesProvider {
|
||||
private globalRules: Rules;
|
||||
private options: ts.FormatCodeSettings;
|
||||
private activeRules: Rule[];
|
||||
private rulesMap: RulesMap;
|
||||
|
||||
constructor() {
|
||||
this.globalRules = new Rules();
|
||||
const activeRules = this.globalRules.HighPriorityCommonRules.slice(0).concat(this.globalRules.UserConfigurableRules).concat(this.globalRules.LowPriorityCommonRules);
|
||||
this.rulesMap = RulesMap.create(activeRules);
|
||||
}
|
||||
|
||||
public getRuleName(rule: Rule): string {
|
||||
@@ -30,141 +31,8 @@ namespace ts.formatting {
|
||||
|
||||
public ensureUpToDate(options: ts.FormatCodeSettings) {
|
||||
if (!this.options || !ts.compareDataObjects(this.options, options)) {
|
||||
const activeRules = this.createActiveRules(options);
|
||||
const rulesMap = RulesMap.create(activeRules);
|
||||
|
||||
this.activeRules = activeRules;
|
||||
this.rulesMap = rulesMap;
|
||||
this.options = ts.clone(options);
|
||||
}
|
||||
}
|
||||
|
||||
private createActiveRules(options: ts.FormatCodeSettings): Rule[] {
|
||||
let rules = this.globalRules.HighPriorityCommonRules.slice(0);
|
||||
|
||||
if (options.insertSpaceAfterConstructor) {
|
||||
rules.push(this.globalRules.SpaceAfterConstructor);
|
||||
}
|
||||
else {
|
||||
rules.push(this.globalRules.NoSpaceAfterConstructor);
|
||||
}
|
||||
|
||||
if (options.insertSpaceAfterCommaDelimiter) {
|
||||
rules.push(this.globalRules.SpaceAfterComma);
|
||||
}
|
||||
else {
|
||||
rules.push(this.globalRules.NoSpaceAfterComma);
|
||||
}
|
||||
|
||||
if (options.insertSpaceAfterFunctionKeywordForAnonymousFunctions) {
|
||||
rules.push(this.globalRules.SpaceAfterAnonymousFunctionKeyword);
|
||||
}
|
||||
else {
|
||||
rules.push(this.globalRules.NoSpaceAfterAnonymousFunctionKeyword);
|
||||
}
|
||||
|
||||
if (options.insertSpaceAfterKeywordsInControlFlowStatements) {
|
||||
rules.push(this.globalRules.SpaceAfterKeywordInControl);
|
||||
}
|
||||
else {
|
||||
rules.push(this.globalRules.NoSpaceAfterKeywordInControl);
|
||||
}
|
||||
|
||||
if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis) {
|
||||
rules.push(this.globalRules.SpaceAfterOpenParen);
|
||||
rules.push(this.globalRules.SpaceBeforeCloseParen);
|
||||
rules.push(this.globalRules.NoSpaceBetweenParens);
|
||||
}
|
||||
else {
|
||||
rules.push(this.globalRules.NoSpaceAfterOpenParen);
|
||||
rules.push(this.globalRules.NoSpaceBeforeCloseParen);
|
||||
rules.push(this.globalRules.NoSpaceBetweenParens);
|
||||
}
|
||||
|
||||
if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets) {
|
||||
rules.push(this.globalRules.SpaceAfterOpenBracket);
|
||||
rules.push(this.globalRules.SpaceBeforeCloseBracket);
|
||||
rules.push(this.globalRules.NoSpaceBetweenBrackets);
|
||||
}
|
||||
else {
|
||||
rules.push(this.globalRules.NoSpaceAfterOpenBracket);
|
||||
rules.push(this.globalRules.NoSpaceBeforeCloseBracket);
|
||||
rules.push(this.globalRules.NoSpaceBetweenBrackets);
|
||||
}
|
||||
|
||||
// The default value of InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces is true
|
||||
// so if the option is undefined, we should treat it as true as well
|
||||
if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces !== false) {
|
||||
rules.push(this.globalRules.SpaceAfterOpenBrace);
|
||||
rules.push(this.globalRules.SpaceBeforeCloseBrace);
|
||||
rules.push(this.globalRules.NoSpaceBetweenEmptyBraceBrackets);
|
||||
}
|
||||
else {
|
||||
rules.push(this.globalRules.NoSpaceAfterOpenBrace);
|
||||
rules.push(this.globalRules.NoSpaceBeforeCloseBrace);
|
||||
rules.push(this.globalRules.NoSpaceBetweenEmptyBraceBrackets);
|
||||
}
|
||||
|
||||
if (options.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces) {
|
||||
rules.push(this.globalRules.SpaceAfterTemplateHeadAndMiddle);
|
||||
rules.push(this.globalRules.SpaceBeforeTemplateMiddleAndTail);
|
||||
}
|
||||
else {
|
||||
rules.push(this.globalRules.NoSpaceAfterTemplateHeadAndMiddle);
|
||||
rules.push(this.globalRules.NoSpaceBeforeTemplateMiddleAndTail);
|
||||
}
|
||||
|
||||
if (options.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces) {
|
||||
rules.push(this.globalRules.SpaceAfterOpenBraceInJsxExpression);
|
||||
rules.push(this.globalRules.SpaceBeforeCloseBraceInJsxExpression);
|
||||
}
|
||||
else {
|
||||
rules.push(this.globalRules.NoSpaceAfterOpenBraceInJsxExpression);
|
||||
rules.push(this.globalRules.NoSpaceBeforeCloseBraceInJsxExpression);
|
||||
}
|
||||
|
||||
if (options.insertSpaceAfterSemicolonInForStatements) {
|
||||
rules.push(this.globalRules.SpaceAfterSemicolonInFor);
|
||||
}
|
||||
else {
|
||||
rules.push(this.globalRules.NoSpaceAfterSemicolonInFor);
|
||||
}
|
||||
|
||||
if (options.insertSpaceBeforeAndAfterBinaryOperators) {
|
||||
rules.push(this.globalRules.SpaceBeforeBinaryOperator);
|
||||
rules.push(this.globalRules.SpaceAfterBinaryOperator);
|
||||
}
|
||||
else {
|
||||
rules.push(this.globalRules.NoSpaceBeforeBinaryOperator);
|
||||
rules.push(this.globalRules.NoSpaceAfterBinaryOperator);
|
||||
}
|
||||
|
||||
if (options.insertSpaceBeforeFunctionParenthesis) {
|
||||
rules.push(this.globalRules.SpaceBeforeOpenParenInFuncDecl);
|
||||
}
|
||||
else {
|
||||
rules.push(this.globalRules.NoSpaceBeforeOpenParenInFuncDecl);
|
||||
}
|
||||
|
||||
if (options.placeOpenBraceOnNewLineForControlBlocks) {
|
||||
rules.push(this.globalRules.NewLineBeforeOpenBraceInControl);
|
||||
}
|
||||
|
||||
if (options.placeOpenBraceOnNewLineForFunctions) {
|
||||
rules.push(this.globalRules.NewLineBeforeOpenBraceInFunction);
|
||||
rules.push(this.globalRules.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock);
|
||||
}
|
||||
|
||||
if (options.insertSpaceAfterTypeAssertion) {
|
||||
rules.push(this.globalRules.SpaceAfterTypeAssertion);
|
||||
}
|
||||
else {
|
||||
rules.push(this.globalRules.NoSpaceAfterTypeAssertion);
|
||||
}
|
||||
|
||||
rules = rules.concat(this.globalRules.LowPriorityCommonRules);
|
||||
|
||||
return rules;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ namespace ts.formatting {
|
||||
let current = position;
|
||||
while (current > 0) {
|
||||
const char = sourceFile.text.charCodeAt(current);
|
||||
if (!isWhiteSpace(char)) {
|
||||
if (!isWhiteSpaceLike(char)) {
|
||||
break;
|
||||
}
|
||||
current--;
|
||||
|
||||
@@ -387,6 +387,7 @@ namespace ts.FindAllReferences {
|
||||
symbol: Symbol;
|
||||
exportInfo: ExportInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a local reference, we might notice that it's an import/export and recursively search for references of that.
|
||||
* If at an import, look locally for the symbol it imports.
|
||||
@@ -398,7 +399,7 @@ namespace ts.FindAllReferences {
|
||||
return comingFromExport ? getExport() : getExport() || getImport();
|
||||
|
||||
function getExport(): ExportedSymbol | ImportedSymbol | undefined {
|
||||
const { parent } = node;
|
||||
const parent = node.parent!;
|
||||
if (symbol.flags & SymbolFlags.Export) {
|
||||
if (parent.kind === SyntaxKind.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.
|
||||
@@ -414,8 +415,8 @@ namespace ts.FindAllReferences {
|
||||
}
|
||||
}
|
||||
else {
|
||||
const exportNode = parent.kind === SyntaxKind.VariableDeclaration ? getAncestor(parent, SyntaxKind.VariableStatement) : parent;
|
||||
if (hasModifier(exportNode, ModifierFlags.Export)) {
|
||||
const exportNode = getExportNode(parent);
|
||||
if (exportNode && hasModifier(exportNode, ModifierFlags.Export)) {
|
||||
if (exportNode.kind === SyntaxKind.ImportEqualsDeclaration && (exportNode as ImportEqualsDeclaration).moduleReference === node) {
|
||||
// We're at `Y` in `export import X = Y`. This is not the exported symbol, the left-hand-side is. So treat this as an import statement.
|
||||
if (comingFromExport) {
|
||||
@@ -492,6 +493,16 @@ namespace ts.FindAllReferences {
|
||||
}
|
||||
}
|
||||
|
||||
// If a reference is a variable declaration, the exported node would be the variable statement.
|
||||
function getExportNode(parent: Node): Node | undefined {
|
||||
if (parent.kind === SyntaxKind.VariableDeclaration) {
|
||||
const p = parent as ts.VariableDeclaration;
|
||||
return p.parent.kind === ts.SyntaxKind.CatchClause ? undefined : p.parent.parent.kind === SyntaxKind.VariableStatement ? p.parent.parent : undefined;
|
||||
} else {
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
|
||||
function isNodeImport(node: Node): { isNamedImport: boolean } | undefined {
|
||||
const { parent } = node;
|
||||
switch (parent.kind) {
|
||||
|
||||
@@ -31,6 +31,9 @@ namespace ts {
|
||||
/** The version of the language service API */
|
||||
export const servicesVersion = "0.5";
|
||||
|
||||
/* @internal */
|
||||
let ruleProvider: formatting.RulesProvider;
|
||||
|
||||
function createNode<TKind extends SyntaxKind>(kind: TKind, pos: number, end: number, parent?: Node): NodeObject | TokenObject<TKind> | IdentifierObject {
|
||||
const node = kind >= SyntaxKind.FirstNode ? new NodeObject(kind, pos, end) :
|
||||
kind === SyntaxKind.Identifier ? new IdentifierObject(SyntaxKind.Identifier, pos, end) :
|
||||
@@ -1040,10 +1043,9 @@ namespace ts {
|
||||
documentRegistry: DocumentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory())): LanguageService {
|
||||
|
||||
const syntaxTreeCache: SyntaxTreeCache = new SyntaxTreeCache(host);
|
||||
let ruleProvider: formatting.RulesProvider;
|
||||
ruleProvider = ruleProvider || new formatting.RulesProvider();
|
||||
let program: Program;
|
||||
let lastProjectVersion: string;
|
||||
|
||||
let lastTypesRootVersion = 0;
|
||||
|
||||
const useCaseSensitivefileNames = host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames();
|
||||
@@ -1072,11 +1074,6 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getRuleProvider(options: FormatCodeSettings) {
|
||||
// Ensure rules are initialized and up to date wrt to formatting options
|
||||
if (!ruleProvider) {
|
||||
ruleProvider = new formatting.RulesProvider();
|
||||
}
|
||||
|
||||
ruleProvider.ensureUpToDate(options);
|
||||
return ruleProvider;
|
||||
}
|
||||
|
||||
@@ -1244,4 +1244,4 @@ namespace TypeScript.Services {
|
||||
// TODO: it should be moved into a namespace though.
|
||||
|
||||
/* @internal */
|
||||
const toolsVersion = "2.3";
|
||||
const toolsVersion = "2.4";
|
||||
@@ -608,7 +608,7 @@ namespace ts.textChanges {
|
||||
if (force || !isTrivia(s)) {
|
||||
this.lastNonTriviaPosition = this.writer.getTextPos();
|
||||
let i = 0;
|
||||
while (isWhiteSpace(s.charCodeAt(s.length - i - 1))) {
|
||||
while (isWhiteSpaceLike(s.charCodeAt(s.length - i - 1))) {
|
||||
i++;
|
||||
}
|
||||
// trim trailing whitespaces
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace ts {
|
||||
reportDiagnostics?: boolean;
|
||||
moduleName?: string;
|
||||
renamedDependencies?: MapLike<string>;
|
||||
transformers?: CustomTransformers;
|
||||
}
|
||||
|
||||
export interface TranspileOutput {
|
||||
@@ -103,7 +104,7 @@ namespace ts {
|
||||
addRange(/*to*/ diagnostics, /*from*/ program.getOptionsDiagnostics());
|
||||
}
|
||||
// Emit
|
||||
program.emit();
|
||||
program.emit(/*targetSourceFile*/ undefined, /*writeFile*/ undefined, /*cancellationToken*/ undefined, /*emitOnlyDtsFiles*/ undefined, transpileOptions.transformers);
|
||||
|
||||
Debug.assert(outputText !== undefined, "Output generation failed");
|
||||
|
||||
|
||||
@@ -1036,6 +1036,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function compareDataObjects(dst: any, src: any): boolean {
|
||||
if (!dst || !src || Object.keys(dst).length !== Object.keys(src).length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const e in dst) {
|
||||
if (typeof dst[e] === "object") {
|
||||
if (!compareDataObjects(dst[e], src[e])) {
|
||||
@@ -1380,7 +1384,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function getFirstNonSpaceCharacterPosition(text: string, position: number) {
|
||||
while (isWhiteSpace(text.charCodeAt(position))) {
|
||||
while (isWhiteSpaceLike(text.charCodeAt(position))) {
|
||||
position += 1;
|
||||
}
|
||||
return position;
|
||||
|
||||
@@ -59,7 +59,7 @@ var X;
|
||||
(function (X) {
|
||||
var Y;
|
||||
(function (Y) {
|
||||
var Point;
|
||||
let Point;
|
||||
(function (Point) {
|
||||
Point.Origin = new Point(0, 0);
|
||||
})(Point = Y.Point || (Y.Point = {}));
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
//// [file.tsx]
|
||||
import React = require('react');
|
||||
|
||||
interface Prop {
|
||||
a: number,
|
||||
b: string,
|
||||
children: string | JSX.Element
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
|
||||
// OK
|
||||
let k = <Comp a={10} b="hi" children ="lol" />;
|
||||
let k1 =
|
||||
<Comp a={10} b="hi">
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
let k2 =
|
||||
<Comp a={10} b="hi">
|
||||
<div>hi hi hi!</div>
|
||||
</Comp>;
|
||||
|
||||
//// [file.jsx]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var React = require("react");
|
||||
function Comp(p) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
// OK
|
||||
var k = <Comp a={10} b="hi" children="lol"/>;
|
||||
var k1 = <Comp a={10} b="hi">
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
var k2 = <Comp a={10} b="hi">
|
||||
<div>hi hi hi!</div>
|
||||
</Comp>;
|
||||
@@ -0,0 +1,67 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
import React = require('react');
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
|
||||
interface Prop {
|
||||
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
|
||||
|
||||
a: number,
|
||||
>a : Symbol(Prop.a, Decl(file.tsx, 2, 16))
|
||||
|
||||
b: string,
|
||||
>b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
|
||||
children: string | JSX.Element
|
||||
>children : Symbol(Prop.children, Decl(file.tsx, 4, 14))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 6, 1))
|
||||
>p : Symbol(p, Decl(file.tsx, 8, 14))
|
||||
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
|
||||
|
||||
return <div>{p.b}</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>p.b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
>p : Symbol(p, Decl(file.tsx, 8, 14))
|
||||
>b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
}
|
||||
|
||||
// OK
|
||||
let k = <Comp a={10} b="hi" children ="lol" />;
|
||||
>k : Symbol(k, Decl(file.tsx, 13, 3))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 6, 1))
|
||||
>a : Symbol(a, Decl(file.tsx, 13, 13))
|
||||
>b : Symbol(b, Decl(file.tsx, 13, 20))
|
||||
>children : Symbol(children, Decl(file.tsx, 13, 27))
|
||||
|
||||
let k1 =
|
||||
>k1 : Symbol(k1, Decl(file.tsx, 14, 3))
|
||||
|
||||
<Comp a={10} b="hi">
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 6, 1))
|
||||
>a : Symbol(a, Decl(file.tsx, 15, 9))
|
||||
>b : Symbol(b, Decl(file.tsx, 15, 16))
|
||||
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 6, 1))
|
||||
|
||||
let k2 =
|
||||
>k2 : Symbol(k2, Decl(file.tsx, 18, 3))
|
||||
|
||||
<Comp a={10} b="hi">
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 6, 1))
|
||||
>a : Symbol(a, Decl(file.tsx, 19, 9))
|
||||
>b : Symbol(b, Decl(file.tsx, 19, 16))
|
||||
|
||||
<div>hi hi hi!</div>
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
|
||||
</Comp>;
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 6, 1))
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
import React = require('react');
|
||||
>React : typeof React
|
||||
|
||||
interface Prop {
|
||||
>Prop : Prop
|
||||
|
||||
a: number,
|
||||
>a : number
|
||||
|
||||
b: string,
|
||||
>b : string
|
||||
|
||||
children: string | JSX.Element
|
||||
>children : string | JSX.Element
|
||||
>JSX : any
|
||||
>Element : JSX.Element
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>p : Prop
|
||||
>Prop : Prop
|
||||
|
||||
return <div>{p.b}</div>;
|
||||
><div>{p.b}</div> : JSX.Element
|
||||
>div : any
|
||||
>p.b : string
|
||||
>p : Prop
|
||||
>b : string
|
||||
>div : any
|
||||
}
|
||||
|
||||
// OK
|
||||
let k = <Comp a={10} b="hi" children ="lol" />;
|
||||
>k : JSX.Element
|
||||
><Comp a={10} b="hi" children ="lol" /> : JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>a : number
|
||||
>10 : 10
|
||||
>b : string
|
||||
>children : string
|
||||
|
||||
let k1 =
|
||||
>k1 : JSX.Element
|
||||
|
||||
<Comp a={10} b="hi">
|
||||
><Comp a={10} b="hi"> hi hi hi! </Comp> : JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>a : number
|
||||
>10 : 10
|
||||
>b : string
|
||||
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
|
||||
let k2 =
|
||||
>k2 : JSX.Element
|
||||
|
||||
<Comp a={10} b="hi">
|
||||
><Comp a={10} b="hi"> <div>hi hi hi!</div> </Comp> : JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>a : number
|
||||
>10 : 10
|
||||
>b : string
|
||||
|
||||
<div>hi hi hi!</div>
|
||||
><div>hi hi hi!</div> : JSX.Element
|
||||
>div : any
|
||||
>div : any
|
||||
|
||||
</Comp>;
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
//// [file.tsx]
|
||||
declare module JSX {
|
||||
interface Element { }
|
||||
interface ElementAttributesProperty { props: {} }
|
||||
interface IntrinsicElements {
|
||||
div: any;
|
||||
h2: any;
|
||||
h1: any;
|
||||
}
|
||||
}
|
||||
|
||||
class Button {
|
||||
props: {}
|
||||
render() {
|
||||
return (<div>My Button</div>)
|
||||
}
|
||||
}
|
||||
|
||||
// OK
|
||||
let k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
let k2 = <div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div>;
|
||||
let k3 = <div> {1} {"That is a number"} </div>;
|
||||
let k4 = <Button> <h2> Hello </h2> </Button>;
|
||||
|
||||
//// [file.jsx]
|
||||
var Button = (function () {
|
||||
function Button() {
|
||||
}
|
||||
Button.prototype.render = function () {
|
||||
return (<div>My Button</div>);
|
||||
};
|
||||
return Button;
|
||||
}());
|
||||
// OK
|
||||
var k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
var k2 = <div> <h2> Hello </h2> {function (user) { return <h2>{user.name}</h2>; }}</div>;
|
||||
var k3 = <div> {1} {"That is a number"} </div>;
|
||||
var k4 = <Button> <h2> Hello </h2> </Button>;
|
||||
@@ -0,0 +1,73 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
declare module JSX {
|
||||
>JSX : Symbol(JSX, Decl(file.tsx, 0, 0))
|
||||
|
||||
interface Element { }
|
||||
>Element : Symbol(Element, Decl(file.tsx, 0, 20))
|
||||
|
||||
interface ElementAttributesProperty { props: {} }
|
||||
>ElementAttributesProperty : Symbol(ElementAttributesProperty, Decl(file.tsx, 1, 22))
|
||||
>props : Symbol(ElementAttributesProperty.props, Decl(file.tsx, 2, 38))
|
||||
|
||||
interface IntrinsicElements {
|
||||
>IntrinsicElements : Symbol(IntrinsicElements, Decl(file.tsx, 2, 50))
|
||||
|
||||
div: any;
|
||||
>div : Symbol(IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
|
||||
h2: any;
|
||||
>h2 : Symbol(IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
|
||||
h1: any;
|
||||
>h1 : Symbol(IntrinsicElements.h1, Decl(file.tsx, 5, 10))
|
||||
}
|
||||
}
|
||||
|
||||
class Button {
|
||||
>Button : Symbol(Button, Decl(file.tsx, 8, 1))
|
||||
|
||||
props: {}
|
||||
>props : Symbol(Button.props, Decl(file.tsx, 10, 14))
|
||||
|
||||
render() {
|
||||
>render : Symbol(Button.render, Decl(file.tsx, 11, 10))
|
||||
|
||||
return (<div>My Button</div>)
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
}
|
||||
}
|
||||
|
||||
// OK
|
||||
let k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
>k1 : Symbol(k1, Decl(file.tsx, 18, 3))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(file.tsx, 5, 10))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(file.tsx, 5, 10))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
|
||||
let k2 = <div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div>;
|
||||
>k2 : Symbol(k2, Decl(file.tsx, 19, 3))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
>user : Symbol(user, Decl(file.tsx, 19, 34))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
>user : Symbol(user, Decl(file.tsx, 19, 34))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
|
||||
let k3 = <div> {1} {"That is a number"} </div>;
|
||||
>k3 : Symbol(k3, Decl(file.tsx, 20, 3))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
|
||||
let k4 = <Button> <h2> Hello </h2> </Button>;
|
||||
>k4 : Symbol(k4, Decl(file.tsx, 21, 3))
|
||||
>Button : Symbol(Button, Decl(file.tsx, 8, 1))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
>Button : Symbol(Button, Decl(file.tsx, 8, 1))
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
declare module JSX {
|
||||
>JSX : any
|
||||
|
||||
interface Element { }
|
||||
>Element : Element
|
||||
|
||||
interface ElementAttributesProperty { props: {} }
|
||||
>ElementAttributesProperty : ElementAttributesProperty
|
||||
>props : {}
|
||||
|
||||
interface IntrinsicElements {
|
||||
>IntrinsicElements : IntrinsicElements
|
||||
|
||||
div: any;
|
||||
>div : any
|
||||
|
||||
h2: any;
|
||||
>h2 : any
|
||||
|
||||
h1: any;
|
||||
>h1 : any
|
||||
}
|
||||
}
|
||||
|
||||
class Button {
|
||||
>Button : Button
|
||||
|
||||
props: {}
|
||||
>props : {}
|
||||
|
||||
render() {
|
||||
>render : () => JSX.Element
|
||||
|
||||
return (<div>My Button</div>)
|
||||
>(<div>My Button</div>) : JSX.Element
|
||||
><div>My Button</div> : JSX.Element
|
||||
>div : any
|
||||
>div : any
|
||||
}
|
||||
}
|
||||
|
||||
// OK
|
||||
let k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
>k1 : JSX.Element
|
||||
><div> <h2> Hello </h2> <h1> world </h1></div> : JSX.Element
|
||||
>div : any
|
||||
><h2> Hello </h2> : JSX.Element
|
||||
>h2 : any
|
||||
>h2 : any
|
||||
><h1> world </h1> : JSX.Element
|
||||
>h1 : any
|
||||
>h1 : any
|
||||
>div : any
|
||||
|
||||
let k2 = <div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div>;
|
||||
>k2 : JSX.Element
|
||||
><div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div> : JSX.Element
|
||||
>div : any
|
||||
><h2> Hello </h2> : JSX.Element
|
||||
>h2 : any
|
||||
>h2 : any
|
||||
>(user: any) => <h2>{user.name}</h2> : (user: any) => JSX.Element
|
||||
>user : any
|
||||
><h2>{user.name}</h2> : JSX.Element
|
||||
>h2 : any
|
||||
>user.name : any
|
||||
>user : any
|
||||
>name : any
|
||||
>h2 : any
|
||||
>div : any
|
||||
|
||||
let k3 = <div> {1} {"That is a number"} </div>;
|
||||
>k3 : JSX.Element
|
||||
><div> {1} {"That is a number"} </div> : JSX.Element
|
||||
>div : any
|
||||
>1 : 1
|
||||
>"That is a number" : "That is a number"
|
||||
>div : any
|
||||
|
||||
let k4 = <Button> <h2> Hello </h2> </Button>;
|
||||
>k4 : JSX.Element
|
||||
><Button> <h2> Hello </h2> </Button> : JSX.Element
|
||||
>Button : typeof Button
|
||||
><h2> Hello </h2> : JSX.Element
|
||||
>h2 : any
|
||||
>h2 : any
|
||||
>Button : typeof Button
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
//// [file.tsx]
|
||||
declare module JSX {
|
||||
interface Element { }
|
||||
interface ElementAttributesProperty { props: {} }
|
||||
interface IntrinsicElements {
|
||||
div: any;
|
||||
h2: any;
|
||||
h1: any;
|
||||
}
|
||||
}
|
||||
|
||||
class Button {
|
||||
props: {}
|
||||
render() {
|
||||
return (<div>My Button</div>)
|
||||
}
|
||||
}
|
||||
|
||||
// OK
|
||||
let k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
let k2 = <div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div>;
|
||||
let k3 = <div> {1} {"That is a number"} </div>;
|
||||
let k4 = <Button> <h2> Hello </h2> </Button>;
|
||||
|
||||
//// [file.jsx]
|
||||
var Button = (function () {
|
||||
function Button() {
|
||||
}
|
||||
Button.prototype.render = function () {
|
||||
return (<div>My Button</div>);
|
||||
};
|
||||
return Button;
|
||||
}());
|
||||
// OK
|
||||
var k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
var k2 = <div> <h2> Hello </h2> {function (user) { return <h2>{user.name}</h2>; }}</div>;
|
||||
var k3 = <div> {1} {"That is a number"} </div>;
|
||||
var k4 = <Button> <h2> Hello </h2> </Button>;
|
||||
@@ -0,0 +1,73 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
declare module JSX {
|
||||
>JSX : Symbol(JSX, Decl(file.tsx, 0, 0))
|
||||
|
||||
interface Element { }
|
||||
>Element : Symbol(Element, Decl(file.tsx, 0, 20))
|
||||
|
||||
interface ElementAttributesProperty { props: {} }
|
||||
>ElementAttributesProperty : Symbol(ElementAttributesProperty, Decl(file.tsx, 1, 22))
|
||||
>props : Symbol(ElementAttributesProperty.props, Decl(file.tsx, 2, 38))
|
||||
|
||||
interface IntrinsicElements {
|
||||
>IntrinsicElements : Symbol(IntrinsicElements, Decl(file.tsx, 2, 50))
|
||||
|
||||
div: any;
|
||||
>div : Symbol(IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
|
||||
h2: any;
|
||||
>h2 : Symbol(IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
|
||||
h1: any;
|
||||
>h1 : Symbol(IntrinsicElements.h1, Decl(file.tsx, 5, 10))
|
||||
}
|
||||
}
|
||||
|
||||
class Button {
|
||||
>Button : Symbol(Button, Decl(file.tsx, 8, 1))
|
||||
|
||||
props: {}
|
||||
>props : Symbol(Button.props, Decl(file.tsx, 10, 14))
|
||||
|
||||
render() {
|
||||
>render : Symbol(Button.render, Decl(file.tsx, 11, 10))
|
||||
|
||||
return (<div>My Button</div>)
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
}
|
||||
}
|
||||
|
||||
// OK
|
||||
let k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
>k1 : Symbol(k1, Decl(file.tsx, 18, 3))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(file.tsx, 5, 10))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(file.tsx, 5, 10))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
|
||||
let k2 = <div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div>;
|
||||
>k2 : Symbol(k2, Decl(file.tsx, 19, 3))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
>user : Symbol(user, Decl(file.tsx, 19, 34))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
>user : Symbol(user, Decl(file.tsx, 19, 34))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
|
||||
let k3 = <div> {1} {"That is a number"} </div>;
|
||||
>k3 : Symbol(k3, Decl(file.tsx, 20, 3))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(file.tsx, 3, 30))
|
||||
|
||||
let k4 = <Button> <h2> Hello </h2> </Button>;
|
||||
>k4 : Symbol(k4, Decl(file.tsx, 21, 3))
|
||||
>Button : Symbol(Button, Decl(file.tsx, 8, 1))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(file.tsx, 4, 11))
|
||||
>Button : Symbol(Button, Decl(file.tsx, 8, 1))
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
declare module JSX {
|
||||
>JSX : any
|
||||
|
||||
interface Element { }
|
||||
>Element : Element
|
||||
|
||||
interface ElementAttributesProperty { props: {} }
|
||||
>ElementAttributesProperty : ElementAttributesProperty
|
||||
>props : {}
|
||||
|
||||
interface IntrinsicElements {
|
||||
>IntrinsicElements : IntrinsicElements
|
||||
|
||||
div: any;
|
||||
>div : any
|
||||
|
||||
h2: any;
|
||||
>h2 : any
|
||||
|
||||
h1: any;
|
||||
>h1 : any
|
||||
}
|
||||
}
|
||||
|
||||
class Button {
|
||||
>Button : Button
|
||||
|
||||
props: {}
|
||||
>props : {}
|
||||
|
||||
render() {
|
||||
>render : () => JSX.Element
|
||||
|
||||
return (<div>My Button</div>)
|
||||
>(<div>My Button</div>) : JSX.Element
|
||||
><div>My Button</div> : JSX.Element
|
||||
>div : any
|
||||
>div : any
|
||||
}
|
||||
}
|
||||
|
||||
// OK
|
||||
let k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
>k1 : JSX.Element
|
||||
><div> <h2> Hello </h2> <h1> world </h1></div> : JSX.Element
|
||||
>div : any
|
||||
><h2> Hello </h2> : JSX.Element
|
||||
>h2 : any
|
||||
>h2 : any
|
||||
><h1> world </h1> : JSX.Element
|
||||
>h1 : any
|
||||
>h1 : any
|
||||
>div : any
|
||||
|
||||
let k2 = <div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div>;
|
||||
>k2 : JSX.Element
|
||||
><div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div> : JSX.Element
|
||||
>div : any
|
||||
><h2> Hello </h2> : JSX.Element
|
||||
>h2 : any
|
||||
>h2 : any
|
||||
>(user: any) => <h2>{user.name}</h2> : (user: any) => JSX.Element
|
||||
>user : any
|
||||
><h2>{user.name}</h2> : JSX.Element
|
||||
>h2 : any
|
||||
>user.name : any
|
||||
>user : any
|
||||
>name : any
|
||||
>h2 : any
|
||||
>div : any
|
||||
|
||||
let k3 = <div> {1} {"That is a number"} </div>;
|
||||
>k3 : JSX.Element
|
||||
><div> {1} {"That is a number"} </div> : JSX.Element
|
||||
>div : any
|
||||
>1 : 1
|
||||
>"That is a number" : "That is a number"
|
||||
>div : any
|
||||
|
||||
let k4 = <Button> <h2> Hello </h2> </Button>;
|
||||
>k4 : JSX.Element
|
||||
><Button> <h2> Hello </h2> </Button> : JSX.Element
|
||||
>Button : typeof Button
|
||||
><h2> Hello </h2> : JSX.Element
|
||||
>h2 : any
|
||||
>h2 : any
|
||||
>Button : typeof Button
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
tests/cases/conformance/jsx/file.tsx(14,15): error TS2322: Type '{ a: 10; b: "hi"; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
Type '{ a: 10; b: "hi"; }' is not assignable to type 'Prop'.
|
||||
Property 'children' is missing in type '{ a: 10; b: "hi"; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(17,11): error TS2710: 'children' are specified twice. The attribute named 'children' will be overwritten.
|
||||
tests/cases/conformance/jsx/file.tsx(25,11): error TS2710: 'children' are specified twice. The attribute named 'children' will be overwritten.
|
||||
tests/cases/conformance/jsx/file.tsx(31,11): error TS2322: Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'Prop'.
|
||||
Types of property 'children' are incompatible.
|
||||
Type '(Element | ((name: string) => Element))[]' is not assignable to type 'string | Element'.
|
||||
Type '(Element | ((name: string) => Element))[]' is not assignable to type 'Element'.
|
||||
Property 'type' is missing in type '(Element | ((name: string) => Element))[]'.
|
||||
tests/cases/conformance/jsx/file.tsx(37,11): error TS2322: Type '{ a: 10; b: "hi"; children: (Element | 1000000)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
Type '{ a: 10; b: "hi"; children: (Element | 1000000)[]; }' is not assignable to type 'Prop'.
|
||||
Types of property 'children' are incompatible.
|
||||
Type '(Element | 1000000)[]' is not assignable to type 'string | Element'.
|
||||
Type '(Element | 1000000)[]' is not assignable to type 'Element'.
|
||||
Property 'type' is missing in type '(Element | 1000000)[]'.
|
||||
tests/cases/conformance/jsx/file.tsx(43,11): error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'Prop'.
|
||||
Types of property 'children' are incompatible.
|
||||
Type '(string | Element)[]' is not assignable to type 'string | Element'.
|
||||
Type '(string | Element)[]' is not assignable to type 'Element'.
|
||||
Property 'type' is missing in type '(string | Element)[]'.
|
||||
tests/cases/conformance/jsx/file.tsx(49,11): error TS2322: Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'Prop'.
|
||||
Types of property 'children' are incompatible.
|
||||
Type 'Element[]' is not assignable to type 'string | Element'.
|
||||
Type 'Element[]' is not assignable to type 'Element'.
|
||||
Property 'type' is missing in type 'Element[]'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (7 errors) ====
|
||||
import React = require('react');
|
||||
|
||||
interface Prop {
|
||||
a: number,
|
||||
b: string,
|
||||
children: string | JSX.Element
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
|
||||
// Error: missing children
|
||||
let k = <Comp a={10} b="hi" />;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; }' is not assignable to type 'Prop'.
|
||||
!!! error TS2322: Property 'children' is missing in type '{ a: 10; b: "hi"; }'.
|
||||
|
||||
let k0 =
|
||||
<Comp a={10} b="hi" children="Random" >
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2710: 'children' are specified twice. The attribute named 'children' will be overwritten.
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
|
||||
let o = {
|
||||
children:"Random"
|
||||
}
|
||||
let k1 =
|
||||
<Comp a={10} b="hi" {...o} >
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2710: 'children' are specified twice. The attribute named 'children' will be overwritten.
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
|
||||
// Error: incorrect type
|
||||
let k2 =
|
||||
<Comp a={10} b="hi">
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'Prop'.
|
||||
!!! error TS2322: Types of property 'children' are incompatible.
|
||||
!!! error TS2322: Type '(Element | ((name: string) => Element))[]' is not assignable to type 'string | Element'.
|
||||
!!! error TS2322: Type '(Element | ((name: string) => Element))[]' is not assignable to type 'Element'.
|
||||
!!! error TS2322: Property 'type' is missing in type '(Element | ((name: string) => Element))[]'.
|
||||
<div> My Div </div>
|
||||
{(name: string) => <div> My name {name} </div>}
|
||||
</Comp>;
|
||||
|
||||
let k3 =
|
||||
<Comp a={10} b="hi">
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (Element | 1000000)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (Element | 1000000)[]; }' is not assignable to type 'Prop'.
|
||||
!!! error TS2322: Types of property 'children' are incompatible.
|
||||
!!! error TS2322: Type '(Element | 1000000)[]' is not assignable to type 'string | Element'.
|
||||
!!! error TS2322: Type '(Element | 1000000)[]' is not assignable to type 'Element'.
|
||||
!!! error TS2322: Property 'type' is missing in type '(Element | 1000000)[]'.
|
||||
<div> My Div </div>
|
||||
{1000000}
|
||||
</Comp>;
|
||||
|
||||
let k4 =
|
||||
<Comp a={10} b="hi" >
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'Prop'.
|
||||
!!! error TS2322: Types of property 'children' are incompatible.
|
||||
!!! error TS2322: Type '(string | Element)[]' is not assignable to type 'string | Element'.
|
||||
!!! error TS2322: Type '(string | Element)[]' is not assignable to type 'Element'.
|
||||
!!! error TS2322: Property 'type' is missing in type '(string | Element)[]'.
|
||||
<div> My Div </div>
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
|
||||
let k5 =
|
||||
<Comp a={10} b="hi" >
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'Prop'.
|
||||
!!! error TS2322: Types of property 'children' are incompatible.
|
||||
!!! error TS2322: Type 'Element[]' is not assignable to type 'string | Element'.
|
||||
!!! error TS2322: Type 'Element[]' is not assignable to type 'Element'.
|
||||
!!! error TS2322: Property 'type' is missing in type 'Element[]'.
|
||||
<div> My Div </div>
|
||||
<div> My Div </div>
|
||||
</Comp>;
|
||||
@@ -0,0 +1,89 @@
|
||||
//// [file.tsx]
|
||||
import React = require('react');
|
||||
|
||||
interface Prop {
|
||||
a: number,
|
||||
b: string,
|
||||
children: string | JSX.Element
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
|
||||
// Error: missing children
|
||||
let k = <Comp a={10} b="hi" />;
|
||||
|
||||
let k0 =
|
||||
<Comp a={10} b="hi" children="Random" >
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
|
||||
let o = {
|
||||
children:"Random"
|
||||
}
|
||||
let k1 =
|
||||
<Comp a={10} b="hi" {...o} >
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
|
||||
// Error: incorrect type
|
||||
let k2 =
|
||||
<Comp a={10} b="hi">
|
||||
<div> My Div </div>
|
||||
{(name: string) => <div> My name {name} </div>}
|
||||
</Comp>;
|
||||
|
||||
let k3 =
|
||||
<Comp a={10} b="hi">
|
||||
<div> My Div </div>
|
||||
{1000000}
|
||||
</Comp>;
|
||||
|
||||
let k4 =
|
||||
<Comp a={10} b="hi" >
|
||||
<div> My Div </div>
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
|
||||
let k5 =
|
||||
<Comp a={10} b="hi" >
|
||||
<div> My Div </div>
|
||||
<div> My Div </div>
|
||||
</Comp>;
|
||||
|
||||
//// [file.jsx]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var React = require("react");
|
||||
function Comp(p) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
// Error: missing children
|
||||
var k = <Comp a={10} b="hi"/>;
|
||||
var k0 = <Comp a={10} b="hi" children="Random">
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
var o = {
|
||||
children: "Random"
|
||||
};
|
||||
var k1 = <Comp a={10} b="hi" {...o}>
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
// Error: incorrect type
|
||||
var k2 = <Comp a={10} b="hi">
|
||||
<div> My Div </div>
|
||||
{function (name) { return <div> My name {name} </div>; }}
|
||||
</Comp>;
|
||||
var k3 = <Comp a={10} b="hi">
|
||||
<div> My Div </div>
|
||||
{1000000}
|
||||
</Comp>;
|
||||
var k4 = <Comp a={10} b="hi">
|
||||
<div> My Div </div>
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
var k5 = <Comp a={10} b="hi">
|
||||
<div> My Div </div>
|
||||
<div> My Div </div>
|
||||
</Comp>;
|
||||
@@ -0,0 +1,79 @@
|
||||
//// [file.tsx]
|
||||
import React = require('react');
|
||||
|
||||
interface IUser {
|
||||
Name: string;
|
||||
}
|
||||
|
||||
interface IFetchUserProps {
|
||||
children: (user: IUser) => JSX.Element;
|
||||
}
|
||||
|
||||
class FetchUser extends React.Component<IFetchUserProps, any> {
|
||||
render() {
|
||||
return this.state
|
||||
? this.props.children(this.state.result)
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
// Ok
|
||||
function UserName0() {
|
||||
return (
|
||||
<FetchUser>
|
||||
{ user => (
|
||||
<h1>{ user.Name }</h1>
|
||||
) }
|
||||
</FetchUser>
|
||||
);
|
||||
}
|
||||
|
||||
function UserName1() {
|
||||
return (
|
||||
<FetchUser>
|
||||
|
||||
{ user => (
|
||||
<h1>{ user.Name }</h1>
|
||||
) }
|
||||
</FetchUser>
|
||||
);
|
||||
}
|
||||
|
||||
//// [file.jsx]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
exports.__esModule = true;
|
||||
var React = require("react");
|
||||
var FetchUser = (function (_super) {
|
||||
__extends(FetchUser, _super);
|
||||
function FetchUser() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
FetchUser.prototype.render = function () {
|
||||
return this.state
|
||||
? this.props.children(this.state.result)
|
||||
: null;
|
||||
};
|
||||
return FetchUser;
|
||||
}(React.Component));
|
||||
// Ok
|
||||
function UserName0() {
|
||||
return (<FetchUser>
|
||||
{function (user) { return (<h1>{user.Name}</h1>); }}
|
||||
</FetchUser>);
|
||||
}
|
||||
function UserName1() {
|
||||
return (<FetchUser>
|
||||
|
||||
{function (user) { return (<h1>{user.Name}</h1>); }}
|
||||
</FetchUser>);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
import React = require('react');
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
|
||||
interface IUser {
|
||||
>IUser : Symbol(IUser, Decl(file.tsx, 0, 32))
|
||||
|
||||
Name: string;
|
||||
>Name : Symbol(IUser.Name, Decl(file.tsx, 2, 17))
|
||||
}
|
||||
|
||||
interface IFetchUserProps {
|
||||
>IFetchUserProps : Symbol(IFetchUserProps, Decl(file.tsx, 4, 1))
|
||||
|
||||
children: (user: IUser) => JSX.Element;
|
||||
>children : Symbol(IFetchUserProps.children, Decl(file.tsx, 6, 27))
|
||||
>user : Symbol(user, Decl(file.tsx, 7, 15))
|
||||
>IUser : Symbol(IUser, Decl(file.tsx, 0, 32))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
}
|
||||
|
||||
class FetchUser extends React.Component<IFetchUserProps, any> {
|
||||
>FetchUser : Symbol(FetchUser, Decl(file.tsx, 8, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>IFetchUserProps : Symbol(IFetchUserProps, Decl(file.tsx, 4, 1))
|
||||
|
||||
render() {
|
||||
>render : Symbol(FetchUser.render, Decl(file.tsx, 10, 63))
|
||||
|
||||
return this.state
|
||||
>this.state : Symbol(React.Component.state, Decl(react.d.ts, 173, 44))
|
||||
>this : Symbol(FetchUser, Decl(file.tsx, 8, 1))
|
||||
>state : Symbol(React.Component.state, Decl(react.d.ts, 173, 44))
|
||||
|
||||
? this.props.children(this.state.result)
|
||||
>this.props.children : Symbol(children, Decl(file.tsx, 6, 27), Decl(react.d.ts, 173, 20))
|
||||
>this.props : Symbol(React.Component.props, Decl(react.d.ts, 166, 37))
|
||||
>this : Symbol(FetchUser, Decl(file.tsx, 8, 1))
|
||||
>props : Symbol(React.Component.props, Decl(react.d.ts, 166, 37))
|
||||
>children : Symbol(children, Decl(file.tsx, 6, 27), Decl(react.d.ts, 173, 20))
|
||||
>this.state : Symbol(React.Component.state, Decl(react.d.ts, 173, 44))
|
||||
>this : Symbol(FetchUser, Decl(file.tsx, 8, 1))
|
||||
>state : Symbol(React.Component.state, Decl(react.d.ts, 173, 44))
|
||||
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
// Ok
|
||||
function UserName0() {
|
||||
>UserName0 : Symbol(UserName0, Decl(file.tsx, 16, 1))
|
||||
|
||||
return (
|
||||
<FetchUser>
|
||||
>FetchUser : Symbol(FetchUser, Decl(file.tsx, 8, 1))
|
||||
|
||||
{ user => (
|
||||
>user : Symbol(user, Decl(file.tsx, 22, 13))
|
||||
|
||||
<h1>{ user.Name }</h1>
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>user.Name : Symbol(IUser.Name, Decl(file.tsx, 2, 17))
|
||||
>user : Symbol(user, Decl(file.tsx, 22, 13))
|
||||
>Name : Symbol(IUser.Name, Decl(file.tsx, 2, 17))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
|
||||
) }
|
||||
</FetchUser>
|
||||
>FetchUser : Symbol(FetchUser, Decl(file.tsx, 8, 1))
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
function UserName1() {
|
||||
>UserName1 : Symbol(UserName1, Decl(file.tsx, 27, 1))
|
||||
|
||||
return (
|
||||
<FetchUser>
|
||||
>FetchUser : Symbol(FetchUser, Decl(file.tsx, 8, 1))
|
||||
|
||||
{ user => (
|
||||
>user : Symbol(user, Decl(file.tsx, 33, 13))
|
||||
|
||||
<h1>{ user.Name }</h1>
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>user.Name : Symbol(IUser.Name, Decl(file.tsx, 2, 17))
|
||||
>user : Symbol(user, Decl(file.tsx, 33, 13))
|
||||
>Name : Symbol(IUser.Name, Decl(file.tsx, 2, 17))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
|
||||
) }
|
||||
</FetchUser>
|
||||
>FetchUser : Symbol(FetchUser, Decl(file.tsx, 8, 1))
|
||||
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
import React = require('react');
|
||||
>React : typeof React
|
||||
|
||||
interface IUser {
|
||||
>IUser : IUser
|
||||
|
||||
Name: string;
|
||||
>Name : string
|
||||
}
|
||||
|
||||
interface IFetchUserProps {
|
||||
>IFetchUserProps : IFetchUserProps
|
||||
|
||||
children: (user: IUser) => JSX.Element;
|
||||
>children : (user: IUser) => JSX.Element
|
||||
>user : IUser
|
||||
>IUser : IUser
|
||||
>JSX : any
|
||||
>Element : JSX.Element
|
||||
}
|
||||
|
||||
class FetchUser extends React.Component<IFetchUserProps, any> {
|
||||
>FetchUser : FetchUser
|
||||
>React.Component : React.Component<IFetchUserProps, any>
|
||||
>React : typeof React
|
||||
>Component : typeof React.Component
|
||||
>IFetchUserProps : IFetchUserProps
|
||||
|
||||
render() {
|
||||
>render : () => JSX.Element
|
||||
|
||||
return this.state
|
||||
>this.state ? this.props.children(this.state.result) : null : JSX.Element
|
||||
>this.state : any
|
||||
>this : this
|
||||
>state : any
|
||||
|
||||
? this.props.children(this.state.result)
|
||||
>this.props.children(this.state.result) : JSX.Element
|
||||
>this.props.children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & React.ReactElement<any>) | (((user: IUser) => JSX.Element) & (string | number | boolean | any[] | React.ReactElement<any>)[])
|
||||
>this.props : IFetchUserProps & { children?: React.ReactNode; }
|
||||
>this : this
|
||||
>props : IFetchUserProps & { children?: React.ReactNode; }
|
||||
>children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & React.ReactElement<any>) | (((user: IUser) => JSX.Element) & (string | number | boolean | any[] | React.ReactElement<any>)[])
|
||||
>this.state.result : any
|
||||
>this.state : any
|
||||
>this : this
|
||||
>state : any
|
||||
>result : any
|
||||
|
||||
: null;
|
||||
>null : null
|
||||
}
|
||||
}
|
||||
|
||||
// Ok
|
||||
function UserName0() {
|
||||
>UserName0 : () => JSX.Element
|
||||
|
||||
return (
|
||||
>( <FetchUser> { user => ( <h1>{ user.Name }</h1> ) } </FetchUser> ) : JSX.Element
|
||||
|
||||
<FetchUser>
|
||||
><FetchUser> { user => ( <h1>{ user.Name }</h1> ) } </FetchUser> : JSX.Element
|
||||
>FetchUser : typeof FetchUser
|
||||
|
||||
{ user => (
|
||||
>user => ( <h1>{ user.Name }</h1> ) : (user: IUser) => JSX.Element
|
||||
>user : IUser
|
||||
>( <h1>{ user.Name }</h1> ) : JSX.Element
|
||||
|
||||
<h1>{ user.Name }</h1>
|
||||
><h1>{ user.Name }</h1> : JSX.Element
|
||||
>h1 : any
|
||||
>user.Name : string
|
||||
>user : IUser
|
||||
>Name : string
|
||||
>h1 : any
|
||||
|
||||
) }
|
||||
</FetchUser>
|
||||
>FetchUser : typeof FetchUser
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
function UserName1() {
|
||||
>UserName1 : () => JSX.Element
|
||||
|
||||
return (
|
||||
>( <FetchUser> { user => ( <h1>{ user.Name }</h1> ) } </FetchUser> ) : JSX.Element
|
||||
|
||||
<FetchUser>
|
||||
><FetchUser> { user => ( <h1>{ user.Name }</h1> ) } </FetchUser> : JSX.Element
|
||||
>FetchUser : typeof FetchUser
|
||||
|
||||
{ user => (
|
||||
>user => ( <h1>{ user.Name }</h1> ) : (user: IUser) => JSX.Element
|
||||
>user : IUser
|
||||
>( <h1>{ user.Name }</h1> ) : JSX.Element
|
||||
|
||||
<h1>{ user.Name }</h1>
|
||||
><h1>{ user.Name }</h1> : JSX.Element
|
||||
>h1 : any
|
||||
>user.Name : string
|
||||
>user : IUser
|
||||
>Name : string
|
||||
>h1 : any
|
||||
|
||||
) }
|
||||
</FetchUser>
|
||||
>FetchUser : typeof FetchUser
|
||||
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
tests/cases/conformance/jsx/file.tsx(24,28): error TS2339: Property 'NAme' does not exist on type 'IUser'.
|
||||
tests/cases/conformance/jsx/file.tsx(32,9): error TS2322: Type '{ children: ((user: IUser) => Element)[]; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<FetchUser> & IFetchUserProps & { children?: ReactNode; }'.
|
||||
Type '{ children: ((user: IUser) => Element)[]; }' is not assignable to type 'IFetchUserProps'.
|
||||
Types of property 'children' are incompatible.
|
||||
Type '((user: IUser) => Element)[]' is not assignable to type '(user: IUser) => Element'.
|
||||
Type '((user: IUser) => Element)[]' provides no match for the signature '(user: IUser): Element'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (2 errors) ====
|
||||
import React = require('react');
|
||||
|
||||
interface IUser {
|
||||
Name: string;
|
||||
}
|
||||
|
||||
interface IFetchUserProps {
|
||||
children: (user: IUser) => JSX.Element;
|
||||
}
|
||||
|
||||
class FetchUser extends React.Component<IFetchUserProps, any> {
|
||||
render() {
|
||||
return this.state
|
||||
? this.props.children(this.state.result)
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
// Error
|
||||
function UserName() {
|
||||
return (
|
||||
<FetchUser>
|
||||
{ user => (
|
||||
<h1>{ user.NAme }</h1>
|
||||
~~~~
|
||||
!!! error TS2339: Property 'NAme' does not exist on type 'IUser'.
|
||||
) }
|
||||
</FetchUser>
|
||||
);
|
||||
}
|
||||
|
||||
function UserName1() {
|
||||
return (
|
||||
<FetchUser>
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ children: ((user: IUser) => Element)[]; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<FetchUser> & IFetchUserProps & { children?: ReactNode; }'.
|
||||
!!! error TS2322: Type '{ children: ((user: IUser) => Element)[]; }' is not assignable to type 'IFetchUserProps'.
|
||||
!!! error TS2322: Types of property 'children' are incompatible.
|
||||
!!! error TS2322: Type '((user: IUser) => Element)[]' is not assignable to type '(user: IUser) => Element'.
|
||||
!!! error TS2322: Type '((user: IUser) => Element)[]' provides no match for the signature '(user: IUser): Element'.
|
||||
|
||||
|
||||
|
||||
{ user => (
|
||||
<h1>{ user.Name }</h1>
|
||||
) }
|
||||
{ user => (
|
||||
<h1>{ user.Name }</h1>
|
||||
) }
|
||||
</FetchUser>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
//// [file.tsx]
|
||||
import React = require('react');
|
||||
|
||||
interface IUser {
|
||||
Name: string;
|
||||
}
|
||||
|
||||
interface IFetchUserProps {
|
||||
children: (user: IUser) => JSX.Element;
|
||||
}
|
||||
|
||||
class FetchUser extends React.Component<IFetchUserProps, any> {
|
||||
render() {
|
||||
return this.state
|
||||
? this.props.children(this.state.result)
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
// Error
|
||||
function UserName() {
|
||||
return (
|
||||
<FetchUser>
|
||||
{ user => (
|
||||
<h1>{ user.NAme }</h1>
|
||||
) }
|
||||
</FetchUser>
|
||||
);
|
||||
}
|
||||
|
||||
function UserName1() {
|
||||
return (
|
||||
<FetchUser>
|
||||
|
||||
|
||||
|
||||
{ user => (
|
||||
<h1>{ user.Name }</h1>
|
||||
) }
|
||||
{ user => (
|
||||
<h1>{ user.Name }</h1>
|
||||
) }
|
||||
</FetchUser>
|
||||
);
|
||||
}
|
||||
|
||||
//// [file.jsx]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
exports.__esModule = true;
|
||||
var React = require("react");
|
||||
var FetchUser = (function (_super) {
|
||||
__extends(FetchUser, _super);
|
||||
function FetchUser() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
FetchUser.prototype.render = function () {
|
||||
return this.state
|
||||
? this.props.children(this.state.result)
|
||||
: null;
|
||||
};
|
||||
return FetchUser;
|
||||
}(React.Component));
|
||||
// Error
|
||||
function UserName() {
|
||||
return (<FetchUser>
|
||||
{function (user) { return (<h1>{user.NAme}</h1>); }}
|
||||
</FetchUser>);
|
||||
}
|
||||
function UserName1() {
|
||||
return (<FetchUser>
|
||||
|
||||
|
||||
|
||||
{function (user) { return (<h1>{user.Name}</h1>); }}
|
||||
{function (user) { return (<h1>{user.Name}</h1>); }}
|
||||
</FetchUser>);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
tests/cases/conformance/jsx/file.tsx(20,15): error TS2322: Type '{ a: 10; b: "hi"; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
Type '{ a: 10; b: "hi"; }' is not assignable to type 'Prop'.
|
||||
Property 'children' is missing in type '{ a: 10; b: "hi"; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(24,11): error TS2322: Type '{ a: 10; b: "hi"; children: Element; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
Type '{ a: 10; b: "hi"; children: Element; }' is not assignable to type 'Prop'.
|
||||
Types of property 'children' are incompatible.
|
||||
Type 'Element' is not assignable to type 'Button'.
|
||||
Property 'render' is missing in type 'Element'.
|
||||
tests/cases/conformance/jsx/file.tsx(28,11): error TS2322: Type '{ a: 10; b: "hi"; children: typeof Button; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
Type '{ a: 10; b: "hi"; children: typeof Button; }' is not assignable to type 'Prop'.
|
||||
Types of property 'children' are incompatible.
|
||||
Type 'typeof Button' is not assignable to type 'Button'.
|
||||
Property 'render' is missing in type 'typeof Button'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (3 errors) ====
|
||||
import React = require('react');
|
||||
|
||||
interface Prop {
|
||||
a: number,
|
||||
b: string,
|
||||
children: Button;
|
||||
}
|
||||
|
||||
class Button extends React.Component<any, any> {
|
||||
render() {
|
||||
return (<div>My Button</div>)
|
||||
}
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
|
||||
// Error: no children specified
|
||||
let k = <Comp a={10} b="hi" />;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; }' is not assignable to type 'Prop'.
|
||||
!!! error TS2322: Property 'children' is missing in type '{ a: 10; b: "hi"; }'.
|
||||
|
||||
// Error: JSX.element is not the same as JSX.ElementClass
|
||||
let k1 =
|
||||
<Comp a={10} b="hi">
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: Element; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: Element; }' is not assignable to type 'Prop'.
|
||||
!!! error TS2322: Types of property 'children' are incompatible.
|
||||
!!! error TS2322: Type 'Element' is not assignable to type 'Button'.
|
||||
!!! error TS2322: Property 'render' is missing in type 'Element'.
|
||||
<Button />
|
||||
</Comp>;
|
||||
let k2 =
|
||||
<Comp a={10} b="hi">
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: typeof Button; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: typeof Button; }' is not assignable to type 'Prop'.
|
||||
!!! error TS2322: Types of property 'children' are incompatible.
|
||||
!!! error TS2322: Type 'typeof Button' is not assignable to type 'Button'.
|
||||
!!! error TS2322: Property 'render' is missing in type 'typeof Button'.
|
||||
{Button}
|
||||
</Comp>;
|
||||
@@ -0,0 +1,68 @@
|
||||
//// [file.tsx]
|
||||
import React = require('react');
|
||||
|
||||
interface Prop {
|
||||
a: number,
|
||||
b: string,
|
||||
children: Button;
|
||||
}
|
||||
|
||||
class Button extends React.Component<any, any> {
|
||||
render() {
|
||||
return (<div>My Button</div>)
|
||||
}
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
|
||||
// Error: no children specified
|
||||
let k = <Comp a={10} b="hi" />;
|
||||
|
||||
// Error: JSX.element is not the same as JSX.ElementClass
|
||||
let k1 =
|
||||
<Comp a={10} b="hi">
|
||||
<Button />
|
||||
</Comp>;
|
||||
let k2 =
|
||||
<Comp a={10} b="hi">
|
||||
{Button}
|
||||
</Comp>;
|
||||
|
||||
//// [file.jsx]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
exports.__esModule = true;
|
||||
var React = require("react");
|
||||
var Button = (function (_super) {
|
||||
__extends(Button, _super);
|
||||
function Button() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Button.prototype.render = function () {
|
||||
return (<div>My Button</div>);
|
||||
};
|
||||
return Button;
|
||||
}(React.Component));
|
||||
function Comp(p) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
// Error: no children specified
|
||||
var k = <Comp a={10} b="hi"/>;
|
||||
// Error: JSX.element is not the same as JSX.ElementClass
|
||||
var k1 = <Comp a={10} b="hi">
|
||||
<Button />
|
||||
</Comp>;
|
||||
var k2 = <Comp a={10} b="hi">
|
||||
{Button}
|
||||
</Comp>;
|
||||
@@ -0,0 +1,91 @@
|
||||
//// [file.tsx]
|
||||
import React = require('react');
|
||||
|
||||
interface Prop {
|
||||
a: number,
|
||||
b: string,
|
||||
children: JSX.Element | JSX.Element[];
|
||||
}
|
||||
|
||||
class Button extends React.Component<any, any> {
|
||||
render() {
|
||||
return (<div>My Button</div>)
|
||||
}
|
||||
}
|
||||
|
||||
function AnotherButton(p: any) {
|
||||
return <h1>Just Another Button</h1>;
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
|
||||
// Ok
|
||||
let k1 =
|
||||
<Comp a={10} b="hi">
|
||||
<Button />
|
||||
<AnotherButton />
|
||||
</Comp>;
|
||||
|
||||
let k2 =
|
||||
<Comp a={10} b="hi">
|
||||
|
||||
|
||||
|
||||
<Button />
|
||||
<AnotherButton />
|
||||
</Comp>;
|
||||
|
||||
let k3 = <Comp a={10} b="hi"><Button />
|
||||
<AnotherButton />
|
||||
</Comp>;
|
||||
|
||||
let k4 = <Comp a={10} b="hi"><Button /></Comp>;
|
||||
|
||||
//// [file.jsx]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
exports.__esModule = true;
|
||||
var React = require("react");
|
||||
var Button = (function (_super) {
|
||||
__extends(Button, _super);
|
||||
function Button() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Button.prototype.render = function () {
|
||||
return (<div>My Button</div>);
|
||||
};
|
||||
return Button;
|
||||
}(React.Component));
|
||||
function AnotherButton(p) {
|
||||
return <h1>Just Another Button</h1>;
|
||||
}
|
||||
function Comp(p) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
// Ok
|
||||
var k1 = <Comp a={10} b="hi">
|
||||
<Button />
|
||||
<AnotherButton />
|
||||
</Comp>;
|
||||
var k2 = <Comp a={10} b="hi">
|
||||
|
||||
|
||||
|
||||
<Button />
|
||||
<AnotherButton />
|
||||
</Comp>;
|
||||
var k3 = <Comp a={10} b="hi"><Button />
|
||||
<AnotherButton />
|
||||
</Comp>;
|
||||
var k4 = <Comp a={10} b="hi"><Button /></Comp>;
|
||||
@@ -0,0 +1,116 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
import React = require('react');
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
|
||||
interface Prop {
|
||||
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
|
||||
|
||||
a: number,
|
||||
>a : Symbol(Prop.a, Decl(file.tsx, 2, 16))
|
||||
|
||||
b: string,
|
||||
>b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
|
||||
children: JSX.Element | JSX.Element[];
|
||||
>children : Symbol(Prop.children, Decl(file.tsx, 4, 14))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
}
|
||||
|
||||
class Button extends React.Component<any, any> {
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
|
||||
render() {
|
||||
>render : Symbol(Button.render, Decl(file.tsx, 8, 48))
|
||||
|
||||
return (<div>My Button</div>)
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
}
|
||||
}
|
||||
|
||||
function AnotherButton(p: any) {
|
||||
>AnotherButton : Symbol(AnotherButton, Decl(file.tsx, 12, 1))
|
||||
>p : Symbol(p, Decl(file.tsx, 14, 23))
|
||||
|
||||
return <h1>Just Another Button</h1>;
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
>p : Symbol(p, Decl(file.tsx, 18, 14))
|
||||
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
|
||||
|
||||
return <div>{p.b}</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>p.b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
>p : Symbol(p, Decl(file.tsx, 18, 14))
|
||||
>b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
}
|
||||
|
||||
// Ok
|
||||
let k1 =
|
||||
>k1 : Symbol(k1, Decl(file.tsx, 23, 3))
|
||||
|
||||
<Comp a={10} b="hi">
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
>a : Symbol(a, Decl(file.tsx, 24, 9))
|
||||
>b : Symbol(b, Decl(file.tsx, 24, 16))
|
||||
|
||||
<Button />
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
|
||||
<AnotherButton />
|
||||
>AnotherButton : Symbol(AnotherButton, Decl(file.tsx, 12, 1))
|
||||
|
||||
</Comp>;
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
|
||||
let k2 =
|
||||
>k2 : Symbol(k2, Decl(file.tsx, 29, 3))
|
||||
|
||||
<Comp a={10} b="hi">
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
>a : Symbol(a, Decl(file.tsx, 30, 9))
|
||||
>b : Symbol(b, Decl(file.tsx, 30, 16))
|
||||
|
||||
|
||||
|
||||
<Button />
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
|
||||
<AnotherButton />
|
||||
>AnotherButton : Symbol(AnotherButton, Decl(file.tsx, 12, 1))
|
||||
|
||||
</Comp>;
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
|
||||
let k3 = <Comp a={10} b="hi"><Button />
|
||||
>k3 : Symbol(k3, Decl(file.tsx, 38, 3))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
>a : Symbol(a, Decl(file.tsx, 38, 14))
|
||||
>b : Symbol(b, Decl(file.tsx, 38, 21))
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
|
||||
<AnotherButton />
|
||||
>AnotherButton : Symbol(AnotherButton, Decl(file.tsx, 12, 1))
|
||||
|
||||
</Comp>;
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
|
||||
let k4 = <Comp a={10} b="hi"><Button /></Comp>;
|
||||
>k4 : Symbol(k4, Decl(file.tsx, 42, 3))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
>a : Symbol(a, Decl(file.tsx, 42, 14))
|
||||
>b : Symbol(b, Decl(file.tsx, 42, 21))
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
import React = require('react');
|
||||
>React : typeof React
|
||||
|
||||
interface Prop {
|
||||
>Prop : Prop
|
||||
|
||||
a: number,
|
||||
>a : number
|
||||
|
||||
b: string,
|
||||
>b : string
|
||||
|
||||
children: JSX.Element | JSX.Element[];
|
||||
>children : JSX.Element | JSX.Element[]
|
||||
>JSX : any
|
||||
>Element : JSX.Element
|
||||
>JSX : any
|
||||
>Element : JSX.Element
|
||||
}
|
||||
|
||||
class Button extends React.Component<any, any> {
|
||||
>Button : Button
|
||||
>React.Component : React.Component<any, any>
|
||||
>React : typeof React
|
||||
>Component : typeof React.Component
|
||||
|
||||
render() {
|
||||
>render : () => JSX.Element
|
||||
|
||||
return (<div>My Button</div>)
|
||||
>(<div>My Button</div>) : JSX.Element
|
||||
><div>My Button</div> : JSX.Element
|
||||
>div : any
|
||||
>div : any
|
||||
}
|
||||
}
|
||||
|
||||
function AnotherButton(p: any) {
|
||||
>AnotherButton : (p: any) => JSX.Element
|
||||
>p : any
|
||||
|
||||
return <h1>Just Another Button</h1>;
|
||||
><h1>Just Another Button</h1> : JSX.Element
|
||||
>h1 : any
|
||||
>h1 : any
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>p : Prop
|
||||
>Prop : Prop
|
||||
|
||||
return <div>{p.b}</div>;
|
||||
><div>{p.b}</div> : JSX.Element
|
||||
>div : any
|
||||
>p.b : string
|
||||
>p : Prop
|
||||
>b : string
|
||||
>div : any
|
||||
}
|
||||
|
||||
// Ok
|
||||
let k1 =
|
||||
>k1 : JSX.Element
|
||||
|
||||
<Comp a={10} b="hi">
|
||||
><Comp a={10} b="hi"> <Button /> <AnotherButton /> </Comp> : JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>a : number
|
||||
>10 : 10
|
||||
>b : string
|
||||
|
||||
<Button />
|
||||
><Button /> : JSX.Element
|
||||
>Button : typeof Button
|
||||
|
||||
<AnotherButton />
|
||||
><AnotherButton /> : JSX.Element
|
||||
>AnotherButton : (p: any) => JSX.Element
|
||||
|
||||
</Comp>;
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
|
||||
let k2 =
|
||||
>k2 : JSX.Element
|
||||
|
||||
<Comp a={10} b="hi">
|
||||
><Comp a={10} b="hi"> <Button /> <AnotherButton /> </Comp> : JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>a : number
|
||||
>10 : 10
|
||||
>b : string
|
||||
|
||||
|
||||
|
||||
<Button />
|
||||
><Button /> : JSX.Element
|
||||
>Button : typeof Button
|
||||
|
||||
<AnotherButton />
|
||||
><AnotherButton /> : JSX.Element
|
||||
>AnotherButton : (p: any) => JSX.Element
|
||||
|
||||
</Comp>;
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
|
||||
let k3 = <Comp a={10} b="hi"><Button />
|
||||
>k3 : JSX.Element
|
||||
><Comp a={10} b="hi"><Button /> <AnotherButton /></Comp> : JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>a : number
|
||||
>10 : 10
|
||||
>b : string
|
||||
><Button /> : JSX.Element
|
||||
>Button : typeof Button
|
||||
|
||||
<AnotherButton />
|
||||
><AnotherButton /> : JSX.Element
|
||||
>AnotherButton : (p: any) => JSX.Element
|
||||
|
||||
</Comp>;
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
|
||||
let k4 = <Comp a={10} b="hi"><Button /></Comp>;
|
||||
>k4 : JSX.Element
|
||||
><Comp a={10} b="hi"><Button /></Comp> : JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>a : number
|
||||
>10 : 10
|
||||
>b : string
|
||||
><Button /> : JSX.Element
|
||||
>Button : typeof Button
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
tests/cases/conformance/jsx/file.tsx(24,16): error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'Prop'.
|
||||
Types of property 'children' are incompatible.
|
||||
Type '(string | Element)[]' is not assignable to type 'Element | Element[]'.
|
||||
Type '(string | Element)[]' is not assignable to type 'Element[]'.
|
||||
Type 'string | Element' is not assignable to type 'Element'.
|
||||
Type 'string' is not assignable to type 'Element'.
|
||||
tests/cases/conformance/jsx/file.tsx(25,16): error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'Prop'.
|
||||
Types of property 'children' are incompatible.
|
||||
Type '(string | Element)[]' is not assignable to type 'Element | Element[]'.
|
||||
Type '(string | Element)[]' is not assignable to type 'Element[]'.
|
||||
tests/cases/conformance/jsx/file.tsx(27,16): error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'Prop'.
|
||||
Types of property 'children' are incompatible.
|
||||
Type '(string | Element)[]' is not assignable to type 'Element | Element[]'.
|
||||
Type '(string | Element)[]' is not assignable to type 'Element[]'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (3 errors) ====
|
||||
import React = require('react');
|
||||
|
||||
interface Prop {
|
||||
a: number,
|
||||
b: string,
|
||||
children: JSX.Element | JSX.Element[];
|
||||
}
|
||||
|
||||
class Button extends React.Component<any, any> {
|
||||
render() {
|
||||
return (<div>My Button</div>)
|
||||
}
|
||||
}
|
||||
|
||||
function AnotherButton(p: any) {
|
||||
return <h1>Just Another Button</h1>;
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
|
||||
// Error: whitespaces matters
|
||||
let k1 = <Comp a={10} b="hi"><Button /> <AnotherButton /></Comp>;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'Prop'.
|
||||
!!! error TS2322: Types of property 'children' are incompatible.
|
||||
!!! error TS2322: Type '(string | Element)[]' is not assignable to type 'Element | Element[]'.
|
||||
!!! error TS2322: Type '(string | Element)[]' is not assignable to type 'Element[]'.
|
||||
!!! error TS2322: Type 'string | Element' is not assignable to type 'Element'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'Element'.
|
||||
let k2 = <Comp a={10} b="hi"><Button />
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'Prop'.
|
||||
!!! error TS2322: Types of property 'children' are incompatible.
|
||||
!!! error TS2322: Type '(string | Element)[]' is not assignable to type 'Element | Element[]'.
|
||||
!!! error TS2322: Type '(string | Element)[]' is not assignable to type 'Element[]'.
|
||||
<AnotherButton /> </Comp>;
|
||||
let k3 = <Comp a={10} b="hi"> <Button />
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'Prop'.
|
||||
!!! error TS2322: Types of property 'children' are incompatible.
|
||||
!!! error TS2322: Type '(string | Element)[]' is not assignable to type 'Element | Element[]'.
|
||||
!!! error TS2322: Type '(string | Element)[]' is not assignable to type 'Element[]'.
|
||||
<AnotherButton /></Comp>;
|
||||
@@ -0,0 +1,66 @@
|
||||
//// [file.tsx]
|
||||
import React = require('react');
|
||||
|
||||
interface Prop {
|
||||
a: number,
|
||||
b: string,
|
||||
children: JSX.Element | JSX.Element[];
|
||||
}
|
||||
|
||||
class Button extends React.Component<any, any> {
|
||||
render() {
|
||||
return (<div>My Button</div>)
|
||||
}
|
||||
}
|
||||
|
||||
function AnotherButton(p: any) {
|
||||
return <h1>Just Another Button</h1>;
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
|
||||
// Error: whitespaces matters
|
||||
let k1 = <Comp a={10} b="hi"><Button /> <AnotherButton /></Comp>;
|
||||
let k2 = <Comp a={10} b="hi"><Button />
|
||||
<AnotherButton /> </Comp>;
|
||||
let k3 = <Comp a={10} b="hi"> <Button />
|
||||
<AnotherButton /></Comp>;
|
||||
|
||||
//// [file.jsx]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
exports.__esModule = true;
|
||||
var React = require("react");
|
||||
var Button = (function (_super) {
|
||||
__extends(Button, _super);
|
||||
function Button() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Button.prototype.render = function () {
|
||||
return (<div>My Button</div>);
|
||||
};
|
||||
return Button;
|
||||
}(React.Component));
|
||||
function AnotherButton(p) {
|
||||
return <h1>Just Another Button</h1>;
|
||||
}
|
||||
function Comp(p) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
// Error: whitespaces matters
|
||||
var k1 = <Comp a={10} b="hi"><Button /> <AnotherButton /></Comp>;
|
||||
var k2 = <Comp a={10} b="hi"><Button />
|
||||
<AnotherButton /> </Comp>;
|
||||
var k3 = <Comp a={10} b="hi"> <Button />
|
||||
<AnotherButton /></Comp>;
|
||||
@@ -0,0 +1,68 @@
|
||||
//// [file.tsx]
|
||||
import React = require('react');
|
||||
|
||||
interface Prop {
|
||||
a: number,
|
||||
b: string,
|
||||
children: string | JSX.Element | (string | JSX.Element)[];
|
||||
}
|
||||
|
||||
class Button extends React.Component<any, any> {
|
||||
render() {
|
||||
return (<div>My Button</div>)
|
||||
}
|
||||
}
|
||||
|
||||
function AnotherButton(p: any) {
|
||||
return <h1>Just Another Button</h1>;
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
|
||||
// OK
|
||||
let k1 = <Comp a={10} b="hi"><Button /> <AnotherButton /></Comp>;
|
||||
let k2 = <Comp a={10} b="hi"><Button />
|
||||
<AnotherButton /> </Comp>;
|
||||
let k3 = <Comp a={10} b="hi"> <Button />
|
||||
<AnotherButton /></Comp>;
|
||||
let k4 = <Comp a={10} b="hi"><Button /> </Comp>;
|
||||
|
||||
//// [file.jsx]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
exports.__esModule = true;
|
||||
var React = require("react");
|
||||
var Button = (function (_super) {
|
||||
__extends(Button, _super);
|
||||
function Button() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Button.prototype.render = function () {
|
||||
return (<div>My Button</div>);
|
||||
};
|
||||
return Button;
|
||||
}(React.Component));
|
||||
function AnotherButton(p) {
|
||||
return <h1>Just Another Button</h1>;
|
||||
}
|
||||
function Comp(p) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
// OK
|
||||
var k1 = <Comp a={10} b="hi"><Button /> <AnotherButton /></Comp>;
|
||||
var k2 = <Comp a={10} b="hi"><Button />
|
||||
<AnotherButton /> </Comp>;
|
||||
var k3 = <Comp a={10} b="hi"> <Button />
|
||||
<AnotherButton /></Comp>;
|
||||
var k4 = <Comp a={10} b="hi"><Button /> </Comp>;
|
||||
@@ -0,0 +1,98 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
import React = require('react');
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
|
||||
interface Prop {
|
||||
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
|
||||
|
||||
a: number,
|
||||
>a : Symbol(Prop.a, Decl(file.tsx, 2, 16))
|
||||
|
||||
b: string,
|
||||
>b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
|
||||
children: string | JSX.Element | (string | JSX.Element)[];
|
||||
>children : Symbol(Prop.children, Decl(file.tsx, 4, 14))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
}
|
||||
|
||||
class Button extends React.Component<any, any> {
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
|
||||
|
||||
render() {
|
||||
>render : Symbol(Button.render, Decl(file.tsx, 8, 48))
|
||||
|
||||
return (<div>My Button</div>)
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
}
|
||||
}
|
||||
|
||||
function AnotherButton(p: any) {
|
||||
>AnotherButton : Symbol(AnotherButton, Decl(file.tsx, 12, 1))
|
||||
>p : Symbol(p, Decl(file.tsx, 14, 23))
|
||||
|
||||
return <h1>Just Another Button</h1>;
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
>p : Symbol(p, Decl(file.tsx, 18, 14))
|
||||
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
|
||||
|
||||
return <div>{p.b}</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>p.b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
>p : Symbol(p, Decl(file.tsx, 18, 14))
|
||||
>b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
}
|
||||
|
||||
// OK
|
||||
let k1 = <Comp a={10} b="hi"><Button /> <AnotherButton /></Comp>;
|
||||
>k1 : Symbol(k1, Decl(file.tsx, 23, 3))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
>a : Symbol(a, Decl(file.tsx, 23, 14))
|
||||
>b : Symbol(b, Decl(file.tsx, 23, 21))
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
>AnotherButton : Symbol(AnotherButton, Decl(file.tsx, 12, 1))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
|
||||
let k2 = <Comp a={10} b="hi"><Button />
|
||||
>k2 : Symbol(k2, Decl(file.tsx, 24, 3))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
>a : Symbol(a, Decl(file.tsx, 24, 14))
|
||||
>b : Symbol(b, Decl(file.tsx, 24, 21))
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
|
||||
<AnotherButton /> </Comp>;
|
||||
>AnotherButton : Symbol(AnotherButton, Decl(file.tsx, 12, 1))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
|
||||
let k3 = <Comp a={10} b="hi"> <Button />
|
||||
>k3 : Symbol(k3, Decl(file.tsx, 26, 3))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
>a : Symbol(a, Decl(file.tsx, 26, 14))
|
||||
>b : Symbol(b, Decl(file.tsx, 26, 21))
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
|
||||
<AnotherButton /></Comp>;
|
||||
>AnotherButton : Symbol(AnotherButton, Decl(file.tsx, 12, 1))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
|
||||
let k4 = <Comp a={10} b="hi"><Button /> </Comp>;
|
||||
>k4 : Symbol(k4, Decl(file.tsx, 28, 3))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
>a : Symbol(a, Decl(file.tsx, 28, 14))
|
||||
>b : Symbol(b, Decl(file.tsx, 28, 21))
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
import React = require('react');
|
||||
>React : typeof React
|
||||
|
||||
interface Prop {
|
||||
>Prop : Prop
|
||||
|
||||
a: number,
|
||||
>a : number
|
||||
|
||||
b: string,
|
||||
>b : string
|
||||
|
||||
children: string | JSX.Element | (string | JSX.Element)[];
|
||||
>children : string | JSX.Element | (string | JSX.Element)[]
|
||||
>JSX : any
|
||||
>Element : JSX.Element
|
||||
>JSX : any
|
||||
>Element : JSX.Element
|
||||
}
|
||||
|
||||
class Button extends React.Component<any, any> {
|
||||
>Button : Button
|
||||
>React.Component : React.Component<any, any>
|
||||
>React : typeof React
|
||||
>Component : typeof React.Component
|
||||
|
||||
render() {
|
||||
>render : () => JSX.Element
|
||||
|
||||
return (<div>My Button</div>)
|
||||
>(<div>My Button</div>) : JSX.Element
|
||||
><div>My Button</div> : JSX.Element
|
||||
>div : any
|
||||
>div : any
|
||||
}
|
||||
}
|
||||
|
||||
function AnotherButton(p: any) {
|
||||
>AnotherButton : (p: any) => JSX.Element
|
||||
>p : any
|
||||
|
||||
return <h1>Just Another Button</h1>;
|
||||
><h1>Just Another Button</h1> : JSX.Element
|
||||
>h1 : any
|
||||
>h1 : any
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>p : Prop
|
||||
>Prop : Prop
|
||||
|
||||
return <div>{p.b}</div>;
|
||||
><div>{p.b}</div> : JSX.Element
|
||||
>div : any
|
||||
>p.b : string
|
||||
>p : Prop
|
||||
>b : string
|
||||
>div : any
|
||||
}
|
||||
|
||||
// OK
|
||||
let k1 = <Comp a={10} b="hi"><Button /> <AnotherButton /></Comp>;
|
||||
>k1 : JSX.Element
|
||||
><Comp a={10} b="hi"><Button /> <AnotherButton /></Comp> : JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>a : number
|
||||
>10 : 10
|
||||
>b : string
|
||||
><Button /> : JSX.Element
|
||||
>Button : typeof Button
|
||||
><AnotherButton /> : JSX.Element
|
||||
>AnotherButton : (p: any) => JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
|
||||
let k2 = <Comp a={10} b="hi"><Button />
|
||||
>k2 : JSX.Element
|
||||
><Comp a={10} b="hi"><Button /> <AnotherButton /> </Comp> : JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>a : number
|
||||
>10 : 10
|
||||
>b : string
|
||||
><Button /> : JSX.Element
|
||||
>Button : typeof Button
|
||||
|
||||
<AnotherButton /> </Comp>;
|
||||
><AnotherButton /> : JSX.Element
|
||||
>AnotherButton : (p: any) => JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
|
||||
let k3 = <Comp a={10} b="hi"> <Button />
|
||||
>k3 : JSX.Element
|
||||
><Comp a={10} b="hi"> <Button /> <AnotherButton /></Comp> : JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>a : number
|
||||
>10 : 10
|
||||
>b : string
|
||||
><Button /> : JSX.Element
|
||||
>Button : typeof Button
|
||||
|
||||
<AnotherButton /></Comp>;
|
||||
><AnotherButton /> : JSX.Element
|
||||
>AnotherButton : (p: any) => JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
|
||||
let k4 = <Comp a={10} b="hi"><Button /> </Comp>;
|
||||
>k4 : JSX.Element
|
||||
><Comp a={10} b="hi"><Button /> </Comp> : JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>a : number
|
||||
>10 : 10
|
||||
>b : string
|
||||
><Button /> : JSX.Element
|
||||
>Button : typeof Button
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [file.tsx]
|
||||
import React = require('react');
|
||||
|
||||
// OK
|
||||
let k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
let k2 = <div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div>;
|
||||
let k3 = <div> {1} {"That is a number"} </div>;
|
||||
|
||||
//// [file.jsx]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var React = require("react");
|
||||
// OK
|
||||
var k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
var k2 = <div> <h2> Hello </h2> {function (user) { return <h2>{user.name}</h2>; }}</div>;
|
||||
var k3 = <div> {1} {"That is a number"} </div>;
|
||||
@@ -0,0 +1,30 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
import React = require('react');
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
|
||||
// OK
|
||||
let k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
>k1 : Symbol(k1, Decl(file.tsx, 3, 3))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2410, 48))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2410, 48))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2409, 47))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
|
||||
let k2 = <div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div>;
|
||||
>k2 : Symbol(k2, Decl(file.tsx, 4, 3))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2410, 48))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2410, 48))
|
||||
>user : Symbol(user, Decl(file.tsx, 4, 34))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2410, 48))
|
||||
>user : Symbol(user, Decl(file.tsx, 4, 34))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2410, 48))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
|
||||
let k3 = <div> {1} {"That is a number"} </div>;
|
||||
>k3 : Symbol(k3, Decl(file.tsx, 5, 3))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2399, 45))
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
import React = require('react');
|
||||
>React : typeof React
|
||||
|
||||
// OK
|
||||
let k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
>k1 : JSX.Element
|
||||
><div> <h2> Hello </h2> <h1> world </h1></div> : JSX.Element
|
||||
>div : any
|
||||
><h2> Hello </h2> : JSX.Element
|
||||
>h2 : any
|
||||
>h2 : any
|
||||
><h1> world </h1> : JSX.Element
|
||||
>h1 : any
|
||||
>h1 : any
|
||||
>div : any
|
||||
|
||||
let k2 = <div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div>;
|
||||
>k2 : JSX.Element
|
||||
><div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div> : JSX.Element
|
||||
>div : any
|
||||
><h2> Hello </h2> : JSX.Element
|
||||
>h2 : any
|
||||
>h2 : any
|
||||
>(user: any) => <h2>{user.name}</h2> : (user: any) => JSX.Element
|
||||
>user : any
|
||||
><h2>{user.name}</h2> : JSX.Element
|
||||
>h2 : any
|
||||
>user.name : any
|
||||
>user : any
|
||||
>name : any
|
||||
>h2 : any
|
||||
>div : any
|
||||
|
||||
let k3 = <div> {1} {"That is a number"} </div>;
|
||||
>k3 : JSX.Element
|
||||
><div> {1} {"That is a number"} </div> : JSX.Element
|
||||
>div : any
|
||||
>1 : 1
|
||||
>"That is a number" : "That is a number"
|
||||
>div : any
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user