forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.d.ts
367 lines (367 loc) · 18.1 KB
/
helpers.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
declare function $FAIL(message: any): void;
declare function $PRINT(message: any): void;
declare function accessorPropertyAttributesAreCorrect(obj: any, name: any, get: any, set: any, setVerifyHelpProp: any, enumerable: any, configurable: any): boolean;
declare function arrayContains(arr: any, expected: any): boolean;
declare function compareArray(aExpected: any, aActual: any): boolean;
declare function testRun(id: any, path: any, description: any, codeString: any, result: any, error: any): void;
declare var print: any;
declare function dataPropertyAttributesAreCorrect(obj: any, name: any, value: any, writable: any, enumerable: any, configurable: any): boolean;
declare var HoursPerDay: number;
declare var MinutesPerHour: number;
declare var SecondsPerMinute: number;
declare var msPerDay: number;
declare var msPerSecond: number;
declare var msPerMinute: number;
declare var msPerHour: number;
declare var date_1899_end: number;
declare var date_1900_start: number;
declare var date_1969_end: number;
declare var date_1970_start: number;
declare var date_1999_end: number;
declare var date_2000_start: number;
declare var date_2099_end: number;
declare var date_2100_start: number;
declare var $LocalTZ: any, $DST_start_month: any, $DST_start_sunday: any, $DST_start_hour: any, $DST_start_minutes: any, $DST_end_month: any, $DST_end_sunday: any, $DST_end_hour: any, $DST_end_minutes: any;
declare function Day(t: any): number;
declare function TimeWithinDay(t: any): number;
declare function DaysInYear(y: any): number;
declare function DayFromYear(y: any): number;
declare function TimeFromYear(y: any): number;
declare function YearFromTime(t: any): number;
declare function InLeapYear(t: any): number;
declare function DayWithinYear(t: any): number;
declare function MonthFromTime(t: any): number;
declare function DateFromTime(t: any): number;
declare function WeekDay(t: any): number;
declare var LocalTZA: number;
declare function DaysInMonth(m: any, leap: any): any;
declare function GetSundayInMonth(t: any, m: any, count: any): any;
declare function DaylightSavingTA(t: any): number;
declare function LocalTime(t: any): any;
declare function UTC(t: any): number;
declare function HourFromTime(t: any): number;
declare function MinFromTime(t: any): number;
declare function SecFromTime(t: any): number;
declare function msFromTime(t: any): number;
declare function MakeTime(hour: any, min: any, sec: any, ms: any): any;
declare function MakeDay(year: any, month: any, date: any): number;
declare function MakeDate(day: any, time: any): any;
declare function TimeClip(time: any): any;
declare function ConstructDate(year: any, month: any, date: any, hours: any, minutes: any, seconds: any, ms: any): any;
declare function __consolePrintHandle__(msg: any): void;
declare function fnExists(): boolean;
declare var __globalObject: any;
declare function fnGlobalObject(): any;
declare function testPrint(message: any): void;
/**
* It is not yet clear that runTestCase should pass the global object
* as the 'this' binding in the call to testcase.
*/
declare var runTestCase: (testcase: any) => void;
declare function assertTruthy(value: any): void;
/**
* falsy means we expect no error.
* truthy means we expect some error.
* A non-empty string means we expect an error whose .name is that string.
*/
declare var expectedErrorName: boolean;
/**
* What was thrown, or the string 'Falsy' if something falsy was thrown.
* null if test completed normally.
*/
declare var actualError: any;
declare function testStarted(expectedErrName: any): void;
declare function testFinished(): void;
declare function Presenter(): void;
declare var presenter: any;
declare var prec: any;
declare function isEqual(num1: any, num2: any): boolean;
declare function getPrecision(num: any): number;
declare function ToInteger(p: any): any;
declare function checkSequence<T>(arr: Promise<T>, message: string): void;
declare var objectStore: {
object: Object;
};
declare var functionStore: {
fun: () => string;
};
declare function createEmulatedProxy<T>(target: T, emulatedProps: any, success?: any): T;
declare function Section(parentSection: any, id: any, name: any): void;
declare var NotEarlyErrorString: string;
declare var EarlyErrorRePat: string;
declare var NotEarlyError: Error;
declare var $ERROR: any;
declare function BrowserRunner(): void;
declare function TestLoader(): void;
declare function Controller(): void;
declare var controller: any;
declare function isSiteDebugMode(): boolean;
/**
* @description Helper handler method for tagged string templates
*/
declare function testHandler(literals: any): string;
/**
* @description Tests that obj meets the requirements for built-in objects
* defined by the introduction of chapter 15 of the ECMAScript Language Specification.
* @param {Object} obj the object to be tested.
* @param {boolean} isFunction whether the specification describes obj as a function.
* @param {boolean} isConstructor whether the specification describes obj as a constructor.
* @param {String[]} properties an array with the names of the built-in properties of obj,
* excluding length, prototype, or properties with non-default attributes.
* @param {number} length for functions only: the length specified for the function
* or derived from the argument list.
* @author Norbert Lindenberg
*/
declare function testBuiltInObject(obj: any, isFunction: any, isConstructor: any, properties: any, length: any): boolean;
/**
* @description This is a helper file for testing detached typed arrays
* @author Andrei Borodin (anborod)
*/
declare var lib: {
init: () => void;
dispose: () => void;
detachItem: (item: any) => any;
createDetachCallback: (arr: any, detachAfterNumIterations: any, valueToReturn: any) => (item: any) => any;
createDetachValueOfObject: (arr: any, detachAfterNumIterations: any, value: any) => {
valueOf: () => any;
};
createDetachToStringObject: (arr: any, detachAfterNumIterations: any, value: any) => {
toString: () => string;
};
runTestCaseWrapper: (func: any) => void;
expectTypeError: (func: any, reason: any) => void;
expectRangeError: (func: any, reason: any) => void;
expectError: (errorType: any, name: any, func: any, reason: any) => void;
isDetached: (obj: any) => boolean;
};
declare function testIntlOptions(givenOptions: any, expectedOptions: any): void;
/**
* This file contains shared functions for the tests in the conformance test
* suite for the ECMAScript Internationalization API.
* @author Norbert Lindenberg
*/
/**
* @description Calls the provided function for every service constructor in
* the Intl object, until f returns a falsy value. It returns the result of the
* last call to f, mapped to a boolean.
* @param {Function} f the function to call for each service constructor in
* the Intl object.
* @param {Function} Constructor the constructor object to test with.
* @result {Boolean} whether the test succeeded.
*/
declare function testWithIntlConstructors(f: any): boolean;
/**
* Returns the name of the given constructor object, which must be one of
* Intl.Collator, Intl.NumberFormat, or Intl.DateTimeFormat.
* @param {object} Constructor a constructor
* @return {string} the name of the constructor
*/
declare function getConstructorName(Constructor: any): string;
/**
* Taints a named data property of the given object by installing
* a setter that throws an exception.
* @param {object} obj the object whose data property to taint
* @param {string} property the property to taint
*/
declare function taintDataProperty(obj: any, property: any): void;
/**
* Taints a named method of the given object by replacing it with a function
* that throws an exception.
* @param {object} obj the object whose method to taint
* @param {string} property the name of the method to taint
*/
declare function taintMethod(obj: any, property: any): void;
/**
* Taints the given properties (and similarly named properties) by installing
* setters on Object.prototype that throw exceptions.
* @param {Array} properties an array of property names to taint
*/
declare function taintProperties(properties: any): void;
/**
* Taints the Array object by creating a setter for the property "0" and
* replacing some key methods with functions that throw exceptions.
*/
declare function taintArray(): void;
declare var languages: string[];
declare var scripts: string[];
declare var countries: string[];
declare var localeSupportInfo: {};
/**
* Gets locale support info for the given constructor object, which must be one
* of Intl.Collator, Intl.NumberFormat, Intl.DateTimeFormat.
* @param {object} Constructor the constructor for which to get locale support info
* @return {object} locale support info with the following properties:
* supported: array of fully supported language tags
* byFallback: array of language tags that are supported through fallbacks
* unsupported: array of unsupported language tags
*/
declare function getLocaleSupportInfo(Constructor: any): any;
/**
* @description Tests whether locale is a String value representing a
* structurally valid and canonicalized BCP 47 language tag, as defined in
* sections 6.2.2 and 6.2.3 of the ECMAScript Internationalization API
* Specification.
* @param {String} locale the string to be tested.
* @result {Boolean} whether the test succeeded.
*/
declare function isCanonicalizedStructurallyValidLanguageTag(locale: any): boolean;
/**
* Tests whether the named options property is correctly handled by the given constructor.
* @param {object} Constructor the constructor to test.
* @param {string} property the name of the options property to test.
* @param {string} type the type that values of the property are expected to have
* @param {Array} [values] an array of allowed values for the property. Not needed for boolean.
* @param {any} fallback the fallback value that the property assumes if not provided.
* @param {object} testOptions additional options:
* @param {boolean} isOptional whether support for this property is optional for implementations.
* @param {boolean} noReturn whether the resulting value of the property is not returned.
* @param {boolean} isILD whether the resulting value of the property is implementation and locale dependent.
* @param {object} extra additional option to pass along, properties are value -> {option: value}.
* @return {boolean} whether the test succeeded.
*/
declare function testOption(Constructor: any, property: any, type: any, values: any, fallback: any, testOptions: any): boolean;
/**
* Tests whether the named property of the given object has a valid value
* and the default attributes of the properties of an object literal.
* @param {Object} obj the object to be tested.
* @param {string} property the name of the property
* @param {Function|Array} valid either a function that tests value for validity and returns a boolean,
* an array of valid values.
* @exception if the property has an invalid value.
*/
declare function testProperty(obj: any, property: any, valid: any): void;
/**
* Tests whether the named property of the given object, if present at all, has a valid value
* and the default attributes of the properties of an object literal.
* @param {Object} obj the object to be tested.
* @param {string} property the name of the property
* @param {Function|Array} valid either a function that tests value for validity and returns a boolean,
* an array of valid values.
* @exception if the property is present and has an invalid value.
*/
declare function mayHaveProperty(obj: any, property: any, valid: any): void;
/**
* Tests whether the given object has the named property with a valid value
* and the default attributes of the properties of an object literal.
* @param {Object} obj the object to be tested.
* @param {string} property the name of the property
* @param {Function|Array} valid either a function that tests value for validity and returns a boolean,
* an array of valid values.
* @exception if the property is missing or has an invalid value.
*/
declare function mustHaveProperty(obj: any, property: any, valid: any): void;
/**
* Tests whether the given object does not have the named property.
* @param {Object} obj the object to be tested.
* @param {string} property the name of the property
* @exception if the property is present.
*/
declare function mustNotHaveProperty(obj: any, property: any): void;
/**
* Properties of the RegExp constructor that may be affected by use of regular
* expressions, and the default values of these properties. Properties are from
* https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Deprecated_and_obsolete_features#RegExp_Properties
*/
declare var regExpProperties: string[];
declare var regExpPropertiesDefaultValues: any;
/**
* Tests that executing the provided function (which may use regular expressions
* in its implementation) does not create or modify unwanted properties on the
* RegExp constructor.
*/
declare function testForUnwantedRegExpChanges(testFunc: any): void;
/**
* Tests whether name is a valid BCP 47 numbering system name
* and not excluded from use in the ECMAScript Internationalization API.
* @param {string} name the name to be tested.
* @return {boolean} whether name is a valid BCP 47 numbering system name and
* allowed for use in the ECMAScript Internationalization API.
*/
declare function isValidNumberingSystem(name: any): boolean;
/**
* Provides the digits of numbering systems with simple digit mappings,
* as specified in 11.3.2.
*/
declare var numberingSystemDigits: {
arab: string;
arabext: string;
beng: string;
deva: string;
fullwide: string;
gujr: string;
guru: string;
hanidec: string;
khmr: string;
knda: string;
laoo: string;
latn: string;
mlym: string;
mong: string;
mymr: string;
orya: string;
tamldec: string;
telu: string;
thai: string;
tibt: string;
};
/**
* Tests that number formatting is handled correctly. The function checks that the
* digit sequences in formatted output are as specified, converted to the
* selected numbering system, and embedded in consistent localized patterns.
* @param {Array} locales the locales to be tested.
* @param {Array} numberingSystems the numbering systems to be tested.
* @param {Object} options the options to pass to Intl.NumberFormat. Options
* must include {useGrouping: false}, and must cause 1.1 to be formatted
* pre- and post-decimal digits.
* @param {Object} testData maps input data (in ES5 9.3.1 format) to expected output strings
* in unlocalized format with Western digits.
*/
declare function testNumberFormat(locales: any, numberingSystems: any, options: any, testData: any): void;
/**
* Return the components of date-time formats.
* @return {Array} an array with all date-time components.
*/
declare function getDateTimeComponents(): string[];
/**
* Return the valid values for the given date-time component, as specified
* by the table in section 12.1.1.
* @param {string} component a date-time component.
* @return {Array} an array with the valid values for the component.
*/
declare function getDateTimeComponentValues(component: any): any;
/**
* Tests that the given value is valid for the given date-time component.
* @param {string} component a date-time component.
* @param {string} value the value to be tested.
* @return {boolean} true if the test succeeds.
* @exception if the test fails.
*/
declare function testValidDateTimeComponentValue(component: any, value: any): boolean;
/**
* Verifies that the actual array matches the expected one in length, elements,
* and element order.
* @param {Array} expected the expected array.
* @param {Array} actual the actual array.
* @return {boolean} true if the test succeeds.
* @exception if the test fails.
*/
declare function testArraysAreSame(expected: any, actual: any): boolean;
/**
* @description Helper methods for TypedArrays
*/
declare function CreateTypedArrayTypes(): [typeof Int8Array, typeof Uint8Array, typeof Int16Array, typeof Uint16Array, typeof Int32Array, typeof Uint32Array, typeof Float32Array, typeof Float64Array, typeof Uint8ClampedArray];
declare function CreateTypedArrayInstances(obj: any): [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, Uint8ClampedArray];
declare function CreateIntegerTypedArrayTypes(): [typeof Int8Array, typeof Uint8Array, typeof Int16Array, typeof Uint16Array, typeof Int32Array, typeof Uint32Array, typeof Uint8ClampedArray];
declare function CreateIntegerTypedArrays(obj: any): [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Uint8ClampedArray];
declare function CreateTypedRedcuedSetOfArrayTypes(): [typeof Float64Array];
declare function CreateTypedRedcuedSetOfArrays(obj: any): [Float64Array];
declare function CreateTypedArraysFrom(obj: any): [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, Uint8ClampedArray];
declare function CreateTypedArraysOf(obj: any): [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, Uint8ClampedArray];
declare function CreateTypedArraysFromMapFn(obj: any, mapFn: any): [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, Uint8ClampedArray];
declare function CreateTypedArraysFromThisObj(obj: any, mapFn: any, thisArg: any): [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, Uint8ClampedArray];
declare function CreatestringsOf(obj: any): string[];
declare function CreateSignedTypedArrayInstances(obj: any): [Int8Array, Int16Array, Int32Array, Float32Array, Float64Array];
declare function CreateUnSignedTypedArrayInstances(obj: any): [Uint8Array, Uint16Array, Uint32Array, Uint8ClampedArray];
declare var $LOG: any;
declare var WScript: any;
declare var $DONE: any;