Skip to content

Commit 6e3bbcc

Browse files
authored
Merge pull request #12245 from Microsoft/fix12244
Fix string constituent check in checkElementTypeOfArrayOrString
2 parents f13e6d4 + cb1bb19 commit 6e3bbcc

25 files changed

+153528
-138559
lines changed

lib/cancellationToken.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,3 @@ function createCancellationToken(args) {
3939
};
4040
}
4141
module.exports = createCancellationToken;
42-
43-
//# sourceMappingURL=cancellationToken.js.map

lib/lib.d.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5836,6 +5836,7 @@ interface CSSStyleDeclaration {
58365836
writingMode: string | null;
58375837
zIndex: string | null;
58385838
zoom: string | null;
5839+
resize: string | null;
58395840
getPropertyPriority(propertyName: string): string;
58405841
getPropertyValue(propertyName: string): string;
58415842
item(index: number): string;
@@ -5905,6 +5906,7 @@ declare var CanvasGradient: {
59055906
}
59065907

59075908
interface CanvasPattern {
5909+
setTransform(matrix: SVGMatrix): void;
59085910
}
59095911

59105912
declare var CanvasPattern: {
@@ -6330,7 +6332,7 @@ interface DataTransfer {
63306332
effectAllowed: string;
63316333
readonly files: FileList;
63326334
readonly items: DataTransferItemList;
6333-
readonly types: DOMStringList;
6335+
readonly types: string[];
63346336
clearData(format?: string): boolean;
63356337
getData(format: string): string;
63366338
setData(format: string, data: string): boolean;
@@ -12759,7 +12761,7 @@ interface MouseEvent extends UIEvent {
1275912761
readonly x: number;
1276012762
readonly y: number;
1276112763
getModifierState(keyArg: string): boolean;
12762-
initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget): void;
12764+
initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void;
1276312765
}
1276412766

1276512767
declare var MouseEvent: {
@@ -12872,6 +12874,7 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte
1287212874
readonly plugins: PluginArray;
1287312875
readonly pointerEnabled: boolean;
1287412876
readonly webdriver: boolean;
12877+
readonly hardwareConcurrency: number;
1287512878
getGamepads(): Gamepad[];
1287612879
javaEnabled(): boolean;
1287712880
msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void;
@@ -12889,18 +12892,18 @@ interface Node extends EventTarget {
1288912892
readonly attributes: NamedNodeMap;
1289012893
readonly baseURI: string | null;
1289112894
readonly childNodes: NodeList;
12892-
readonly firstChild: Node;
12893-
readonly lastChild: Node;
12895+
readonly firstChild: Node | null;
12896+
readonly lastChild: Node | null;
1289412897
readonly localName: string | null;
1289512898
readonly namespaceURI: string | null;
12896-
readonly nextSibling: Node;
12899+
readonly nextSibling: Node | null;
1289712900
readonly nodeName: string;
1289812901
readonly nodeType: number;
1289912902
nodeValue: string | null;
1290012903
readonly ownerDocument: Document;
12901-
readonly parentElement: HTMLElement;
12902-
readonly parentNode: Node;
12903-
readonly previousSibling: Node;
12904+
readonly parentElement: HTMLElement | null;
12905+
readonly parentNode: Node | null;
12906+
readonly previousSibling: Node | null;
1290412907
textContent: string | null;
1290512908
appendChild(newChild: Node): Node;
1290612909
cloneNode(deep?: boolean): Node;
@@ -17010,7 +17013,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
1701017013
readonly devicePixelRatio: number;
1701117014
readonly doNotTrack: string;
1701217015
readonly document: Document;
17013-
event: Event;
17016+
event: Event | undefined;
1701417017
readonly external: External;
1701517018
readonly frameElement: Element;
1701617019
readonly frames: Window;
@@ -17312,6 +17315,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
1731217315
readonly upload: XMLHttpRequestUpload;
1731317316
withCredentials: boolean;
1731417317
msCaching?: string;
17318+
readonly responseURL: string;
1731517319
abort(): void;
1731617320
getAllResponseHeaders(): string;
1731717321
getResponseHeader(header: string): string | null;
@@ -18458,7 +18462,7 @@ declare var defaultStatus: string;
1845818462
declare var devicePixelRatio: number;
1845918463
declare var doNotTrack: string;
1846018464
declare var document: Document;
18461-
declare var event: Event;
18465+
declare var event: Event | undefined;
1846218466
declare var external: External;
1846318467
declare var frameElement: Element;
1846418468
declare var frames: Window;

lib/lib.dom.d.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,6 +1699,7 @@ interface CSSStyleDeclaration {
16991699
writingMode: string | null;
17001700
zIndex: string | null;
17011701
zoom: string | null;
1702+
resize: string | null;
17021703
getPropertyPriority(propertyName: string): string;
17031704
getPropertyValue(propertyName: string): string;
17041705
item(index: number): string;
@@ -1768,6 +1769,7 @@ declare var CanvasGradient: {
17681769
}
17691770

17701771
interface CanvasPattern {
1772+
setTransform(matrix: SVGMatrix): void;
17711773
}
17721774

17731775
declare var CanvasPattern: {
@@ -2193,7 +2195,7 @@ interface DataTransfer {
21932195
effectAllowed: string;
21942196
readonly files: FileList;
21952197
readonly items: DataTransferItemList;
2196-
readonly types: DOMStringList;
2198+
readonly types: string[];
21972199
clearData(format?: string): boolean;
21982200
getData(format: string): string;
21992201
setData(format: string, data: string): boolean;
@@ -8622,7 +8624,7 @@ interface MouseEvent extends UIEvent {
86228624
readonly x: number;
86238625
readonly y: number;
86248626
getModifierState(keyArg: string): boolean;
8625-
initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget): void;
8627+
initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void;
86268628
}
86278629

86288630
declare var MouseEvent: {
@@ -8735,6 +8737,7 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte
87358737
readonly plugins: PluginArray;
87368738
readonly pointerEnabled: boolean;
87378739
readonly webdriver: boolean;
8740+
readonly hardwareConcurrency: number;
87388741
getGamepads(): Gamepad[];
87398742
javaEnabled(): boolean;
87408743
msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void;
@@ -8752,18 +8755,18 @@ interface Node extends EventTarget {
87528755
readonly attributes: NamedNodeMap;
87538756
readonly baseURI: string | null;
87548757
readonly childNodes: NodeList;
8755-
readonly firstChild: Node;
8756-
readonly lastChild: Node;
8758+
readonly firstChild: Node | null;
8759+
readonly lastChild: Node | null;
87578760
readonly localName: string | null;
87588761
readonly namespaceURI: string | null;
8759-
readonly nextSibling: Node;
8762+
readonly nextSibling: Node | null;
87608763
readonly nodeName: string;
87618764
readonly nodeType: number;
87628765
nodeValue: string | null;
87638766
readonly ownerDocument: Document;
8764-
readonly parentElement: HTMLElement;
8765-
readonly parentNode: Node;
8766-
readonly previousSibling: Node;
8767+
readonly parentElement: HTMLElement | null;
8768+
readonly parentNode: Node | null;
8769+
readonly previousSibling: Node | null;
87678770
textContent: string | null;
87688771
appendChild(newChild: Node): Node;
87698772
cloneNode(deep?: boolean): Node;
@@ -12873,7 +12876,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
1287312876
readonly devicePixelRatio: number;
1287412877
readonly doNotTrack: string;
1287512878
readonly document: Document;
12876-
event: Event;
12879+
event: Event | undefined;
1287712880
readonly external: External;
1287812881
readonly frameElement: Element;
1287912882
readonly frames: Window;
@@ -13175,6 +13178,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
1317513178
readonly upload: XMLHttpRequestUpload;
1317613179
withCredentials: boolean;
1317713180
msCaching?: string;
13181+
readonly responseURL: string;
1317813182
abort(): void;
1317913183
getAllResponseHeaders(): string;
1318013184
getResponseHeader(header: string): string | null;
@@ -14321,7 +14325,7 @@ declare var defaultStatus: string;
1432114325
declare var devicePixelRatio: number;
1432214326
declare var doNotTrack: string;
1432314327
declare var document: Document;
14324-
declare var event: Event;
14328+
declare var event: Event | undefined;
1432514329
declare var external: External;
1432614330
declare var frameElement: Element;
1432714331
declare var frames: Window;

lib/lib.es2015.core.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,27 +225,27 @@ interface NumberConstructor {
225225
* number. Only finite values of the type number, result in true.
226226
* @param number A numeric value.
227227
*/
228-
isFinite(number: number): boolean;
228+
isFinite(value: any): value is number;
229229

230230
/**
231231
* Returns true if the value passed is an integer, false otherwise.
232232
* @param number A numeric value.
233233
*/
234-
isInteger(number: number): boolean;
234+
isInteger(value: any): value is number;
235235

236236
/**
237237
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
238238
* number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter
239239
* to a number. Only values of the type number, that are also NaN, result in true.
240240
* @param number A numeric value.
241241
*/
242-
isNaN(number: number): boolean;
242+
isNaN(value: any): value is number;
243243

244244
/**
245245
* Returns true if the value passed is a safe integer.
246246
* @param number A numeric value.
247247
*/
248-
isSafeInteger(number: number): boolean;
248+
isSafeInteger(value: any): value is number;
249249

250250
/**
251251
* The value of the largest integer n such that n and n + 1 are both exactly representable as

lib/lib.es2015.proxy.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ and limitations under the License.
1919

2020

2121
interface ProxyHandler<T> {
22-
getPrototypeOf? (target: T): any;
22+
getPrototypeOf? (target: T): {} | null;
2323
setPrototypeOf? (target: T, v: any): boolean;
2424
isExtensible? (target: T): boolean;
2525
preventExtensions? (target: T): boolean;
@@ -32,11 +32,11 @@ interface ProxyHandler<T> {
3232
enumerate? (target: T): PropertyKey[];
3333
ownKeys? (target: T): PropertyKey[];
3434
apply? (target: T, thisArg: any, argArray?: any): any;
35-
construct? (target: T, thisArg: any, argArray?: any): any;
35+
construct? (target: T, argArray: any, newTarget?: any): {};
3636
}
3737

3838
interface ProxyConstructor {
3939
revocable<T>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
4040
new <T>(target: T, handler: ProxyHandler<T>): T
4141
}
42-
declare var Proxy: ProxyConstructor;
42+
declare var Proxy: ProxyConstructor;

lib/lib.es2017.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ and limitations under the License.
2020

2121
/// <reference path="lib.es2016.d.ts" />
2222
/// <reference path="lib.es2017.object.d.ts" />
23-
/// <reference path="lib.es2017.sharedmemory.d.ts" />
23+
/// <reference path="lib.es2017.sharedmemory.d.ts" />
24+
/// <reference path="lib.es2017.string.d.ts" />

lib/lib.es2017.object.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ interface ObjectConstructor {
2929
* Returns an array of key/values of the enumerable properties of an object
3030
* @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.
3131
*/
32-
entries<T>(o: { [s: string]: T }): [string, T][];
32+
entries<T extends { [key: string]: any }, K extends keyof T>(o: T): [keyof T, T[K]][];
3333
entries(o: any): [string, any][];
34-
}
34+
}

lib/lib.es2017.string.d.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*! *****************************************************************************
2+
Copyright (c) Microsoft Corporation. All rights reserved.
3+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4+
this file except in compliance with the License. You may obtain a copy of the
5+
License at http://www.apache.org/licenses/LICENSE-2.0
6+
7+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10+
MERCHANTABLITY OR NON-INFRINGEMENT.
11+
12+
See the Apache Version 2.0 License for specific language governing permissions
13+
and limitations under the License.
14+
***************************************************************************** */
15+
16+
17+
18+
/// <reference no-default-lib="true"/>
19+
20+
21+
interface String {
22+
/**
23+
* Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
24+
* The padding is applied from the start (left) of the current string.
25+
*
26+
* @param maxLength The length of the resulting string once the current string has been padded.
27+
* If this parameter is smaller than the current string's length, the current string will be returned as it is.
28+
*
29+
* @param fillString The string to pad the current string with.
30+
* If this string is too long, it will be truncated and the left-most part will be applied.
31+
* The default value for this parameter is " " (U+0020).
32+
*/
33+
padStart(maxLength: number, fillString?: string): string;
34+
35+
/**
36+
* Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
37+
* The padding is applied from the end (right) of the current string.
38+
*
39+
* @param maxLength The length of the resulting string once the current string has been padded.
40+
* If this parameter is smaller than the current string's length, the current string will be returned as it is.
41+
*
42+
* @param fillString The string to pad the current string with.
43+
* If this string is too long, it will be truncated and the left-most part will be applied.
44+
* The default value for this parameter is " " (U+0020).
45+
*/
46+
padEnd(maxLength: number, fillString?: string): string;
47+
}

0 commit comments

Comments
 (0)