mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into controlFlowLetVar
This commit is contained in:
@@ -3,7 +3,6 @@ language: node_js
|
||||
node_js:
|
||||
- 'stable'
|
||||
- '4'
|
||||
- '0.10'
|
||||
|
||||
sudo: false
|
||||
|
||||
@@ -12,13 +11,6 @@ env:
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- os: osx
|
||||
node_js: stable
|
||||
osx_image: xcode7.3
|
||||
env: workerCount=2
|
||||
allow_failures:
|
||||
- os: osx
|
||||
|
||||
branches:
|
||||
only:
|
||||
|
||||
Vendored
+150
-108
@@ -529,8 +529,8 @@ interface NumberConstructor {
|
||||
/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */
|
||||
declare const Number: NumberConstructor;
|
||||
|
||||
interface TemplateStringsArray extends Array<string> {
|
||||
readonly raw: string[];
|
||||
interface TemplateStringsArray extends ReadonlyArray<string> {
|
||||
readonly raw: ReadonlyArray<string>
|
||||
}
|
||||
|
||||
interface Math {
|
||||
@@ -1022,7 +1022,12 @@ interface ReadonlyArray<T> {
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
*/
|
||||
concat(...items: T[]): T[];
|
||||
concat(...items: T[][]): T[];
|
||||
/**
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
*/
|
||||
concat(...items: (T | T[])[]): T[];
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
|
||||
@@ -1071,6 +1076,12 @@ interface ReadonlyArray<T> {
|
||||
* @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.
|
||||
*/
|
||||
map<U>(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => U, thisArg?: any): U[];
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
filter<S extends T>(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => value is S, thisArg?: any): S[];
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
|
||||
@@ -1124,6 +1135,11 @@ interface Array<T> {
|
||||
* Removes the last element from an array and returns it.
|
||||
*/
|
||||
pop(): T | undefined;
|
||||
/**
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
*/
|
||||
concat(...items: T[][]): T[];
|
||||
/**
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
@@ -1271,13 +1287,44 @@ declare type PromiseConstructorLike = new <T>(executor: (resolve: (value?: T | P
|
||||
|
||||
interface PromiseLike<T> {
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then(
|
||||
onfulfilled?: ((value: T) => T | PromiseLike<T>) | undefined | null,
|
||||
onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): PromiseLike<T>;
|
||||
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(
|
||||
onfulfilled: ((value: T) => T | PromiseLike<T>) | undefined | null,
|
||||
onrejected: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<T | TResult>;
|
||||
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(
|
||||
onfulfilled: (value: T) => TResult | PromiseLike<TResult>,
|
||||
onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): PromiseLike<TResult>;
|
||||
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult1, TResult2>(
|
||||
onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>,
|
||||
onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): PromiseLike<TResult1 | TResult2>;
|
||||
}
|
||||
|
||||
interface ArrayLike<T> {
|
||||
@@ -1537,7 +1584,7 @@ interface Int8Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -1545,7 +1592,7 @@ interface Int8Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -1810,7 +1857,7 @@ interface Uint8Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -1818,7 +1865,7 @@ interface Uint8Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -2084,7 +2131,7 @@ interface Uint8ClampedArray {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -2092,7 +2139,7 @@ interface Uint8ClampedArray {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -2357,7 +2404,7 @@ interface Int16Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -2365,7 +2412,7 @@ interface Int16Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -2631,7 +2678,7 @@ interface Uint16Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -2639,7 +2686,7 @@ interface Uint16Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -2904,7 +2951,7 @@ interface Int32Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -2912,7 +2959,7 @@ interface Int32Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -3177,7 +3224,7 @@ interface Uint32Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -3185,7 +3232,7 @@ interface Uint32Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -3450,7 +3497,7 @@ interface Float32Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -3458,7 +3505,7 @@ interface Float32Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -3724,7 +3771,7 @@ interface Float64Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -3732,7 +3779,7 @@ interface Float64Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -3949,12 +3996,9 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedCollatorOptions;
|
||||
}
|
||||
var Collator: {
|
||||
new (locales?: string[], options?: CollatorOptions): Collator;
|
||||
new (locale?: string, options?: CollatorOptions): Collator;
|
||||
(locales?: string[], options?: CollatorOptions): Collator;
|
||||
(locale?: string, options?: CollatorOptions): Collator;
|
||||
supportedLocalesOf(locales: string[], options?: CollatorOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: CollatorOptions): string[];
|
||||
new (locales?: string | string[], options?: CollatorOptions): Collator;
|
||||
(locales?: string | string[], options?: CollatorOptions): Collator;
|
||||
supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[];
|
||||
}
|
||||
|
||||
interface NumberFormatOptions {
|
||||
@@ -3989,12 +4033,9 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedNumberFormatOptions;
|
||||
}
|
||||
var NumberFormat: {
|
||||
new (locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
new (locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
(locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
(locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];
|
||||
new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
|
||||
(locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
|
||||
supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[];
|
||||
}
|
||||
|
||||
interface DateTimeFormatOptions {
|
||||
@@ -4035,90 +4076,51 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedDateTimeFormatOptions;
|
||||
}
|
||||
var DateTimeFormat: {
|
||||
new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];
|
||||
new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[];
|
||||
}
|
||||
}
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Determines whether two strings are equivalent in the current locale.
|
||||
* Determines whether two strings are equivalent in the current or specified locale.
|
||||
* @param that String to compare to target string
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
|
||||
* @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
|
||||
*/
|
||||
localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number;
|
||||
|
||||
/**
|
||||
* Determines whether two strings are equivalent in the current locale.
|
||||
* @param that String to compare to target string
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
|
||||
* @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
|
||||
*/
|
||||
localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number;
|
||||
localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number;
|
||||
}
|
||||
|
||||
interface Number {
|
||||
/**
|
||||
* Converts a number to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a number to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string;
|
||||
toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;
|
||||
}
|
||||
|
||||
interface Date {
|
||||
/**
|
||||
* Converts a date and time to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date and time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
@@ -4248,6 +4250,7 @@ interface KeyAlgorithm {
|
||||
}
|
||||
|
||||
interface KeyboardEventInit extends EventModifierInit {
|
||||
code?: string;
|
||||
key?: string;
|
||||
location?: number;
|
||||
repeat?: boolean;
|
||||
@@ -6410,7 +6413,7 @@ declare var DeviceRotationRate: {
|
||||
new(): DeviceRotationRate;
|
||||
}
|
||||
|
||||
interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent {
|
||||
interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode {
|
||||
/**
|
||||
* Sets or gets the URL for the current document.
|
||||
*/
|
||||
@@ -7473,7 +7476,7 @@ declare var Document: {
|
||||
new(): Document;
|
||||
}
|
||||
|
||||
interface DocumentFragment extends Node, NodeSelector {
|
||||
interface DocumentFragment extends Node, NodeSelector, ParentNode {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -7542,7 +7545,7 @@ declare var EXT_texture_filter_anisotropic: {
|
||||
readonly TEXTURE_MAX_ANISOTROPY_EXT: number;
|
||||
}
|
||||
|
||||
interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode {
|
||||
interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode {
|
||||
readonly classList: DOMTokenList;
|
||||
className: string;
|
||||
readonly clientHeight: number;
|
||||
@@ -7797,6 +7800,16 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
|
||||
getElementsByClassName(classNames: string): NodeListOf<Element>;
|
||||
matches(selector: string): boolean;
|
||||
closest(selector: string): Element | null;
|
||||
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
|
||||
scroll(options?: ScrollToOptions): void;
|
||||
scroll(x: number, y: number): void;
|
||||
scrollTo(options?: ScrollToOptions): void;
|
||||
scrollTo(x: number, y: number): void;
|
||||
scrollBy(options?: ScrollToOptions): void;
|
||||
scrollBy(x: number, y: number): void;
|
||||
insertAdjacentElement(position: string, insertedElement: Element): Element | null;
|
||||
insertAdjacentHTML(where: string, html: string): void;
|
||||
insertAdjacentText(where: string, text: string): void;
|
||||
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -8568,7 +8581,7 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
|
||||
*/
|
||||
toDataURL(type?: string, ...args: any[]): string;
|
||||
toBlob(callback: (result: Blob | null) => void, ... arguments: any[]): void;
|
||||
toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void;
|
||||
}
|
||||
|
||||
declare var HTMLCanvasElement: {
|
||||
@@ -8743,11 +8756,7 @@ interface HTMLElement extends Element {
|
||||
click(): void;
|
||||
dragDrop(): boolean;
|
||||
focus(): void;
|
||||
insertAdjacentElement(position: string, insertedElement: Element): Element;
|
||||
insertAdjacentHTML(where: string, html: string): void;
|
||||
insertAdjacentText(where: string, text: string): void;
|
||||
msGetInputContext(): MSInputMethodContext;
|
||||
scrollIntoView(top?: boolean): void;
|
||||
setActive(): void;
|
||||
addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -10012,6 +10021,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle {
|
||||
*/
|
||||
type: string;
|
||||
import?: Document;
|
||||
integrity: string;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -10300,7 +10310,7 @@ interface HTMLMediaElement extends HTMLElement {
|
||||
*/
|
||||
canPlayType(type: string): string;
|
||||
/**
|
||||
* Fires immediately after the client loads the object.
|
||||
* Resets the audio or video object and loads a new media resource.
|
||||
*/
|
||||
load(): void;
|
||||
/**
|
||||
@@ -10873,6 +10883,7 @@ interface HTMLScriptElement extends HTMLElement {
|
||||
* Sets or retrieves the MIME type for the associated scripting engine.
|
||||
*/
|
||||
type: string;
|
||||
integrity: string;
|
||||
}
|
||||
|
||||
declare var HTMLScriptElement: {
|
||||
@@ -11878,6 +11889,7 @@ interface KeyboardEvent extends UIEvent {
|
||||
readonly repeat: boolean;
|
||||
readonly shiftKey: boolean;
|
||||
readonly which: number;
|
||||
readonly code: string;
|
||||
getModifierState(keyArg: string): boolean;
|
||||
initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void;
|
||||
readonly DOM_KEY_LOCATION_JOYSTICK: number;
|
||||
@@ -13250,6 +13262,7 @@ interface PerformanceTiming {
|
||||
readonly responseStart: number;
|
||||
readonly unloadEventEnd: number;
|
||||
readonly unloadEventStart: number;
|
||||
readonly secureConnectionStart: number;
|
||||
toJSON(): any;
|
||||
}
|
||||
|
||||
@@ -15527,8 +15540,8 @@ declare var StereoPannerNode: {
|
||||
interface Storage {
|
||||
readonly length: number;
|
||||
clear(): void;
|
||||
getItem(key: string): string;
|
||||
key(index: number): string;
|
||||
getItem(key: string): string | null;
|
||||
key(index: number): string | null;
|
||||
removeItem(key: string): void;
|
||||
setItem(key: string, data: string): void;
|
||||
[key: string]: any;
|
||||
@@ -17069,7 +17082,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
onunload: (this: this, ev: Event) => any;
|
||||
onvolumechange: (this: this, ev: Event) => any;
|
||||
onwaiting: (this: this, ev: Event) => any;
|
||||
readonly opener: Window;
|
||||
opener: any;
|
||||
orientation: string | number;
|
||||
readonly outerHeight: number;
|
||||
readonly outerWidth: number;
|
||||
@@ -17124,6 +17137,9 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;
|
||||
webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;
|
||||
webkitRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
scroll(options?: ScrollToOptions): void;
|
||||
scrollTo(options?: ScrollToOptions): void;
|
||||
scrollBy(options?: ScrollToOptions): void;
|
||||
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -18151,6 +18167,20 @@ interface ProgressEventInit extends EventInit {
|
||||
total?: number;
|
||||
}
|
||||
|
||||
interface ScrollOptions {
|
||||
behavior?: ScrollBehavior;
|
||||
}
|
||||
|
||||
interface ScrollToOptions extends ScrollOptions {
|
||||
left?: number;
|
||||
top?: number;
|
||||
}
|
||||
|
||||
interface ScrollIntoViewOptions extends ScrollOptions {
|
||||
block?: ScrollLogicalPosition;
|
||||
inline?: ScrollLogicalPosition;
|
||||
}
|
||||
|
||||
interface ClipboardEventInit extends EventInit {
|
||||
data?: string;
|
||||
dataType?: string;
|
||||
@@ -18194,7 +18224,7 @@ interface EcdsaParams extends Algorithm {
|
||||
}
|
||||
|
||||
interface EcKeyGenParams extends Algorithm {
|
||||
typedCurve: string;
|
||||
namedCurve: string;
|
||||
}
|
||||
|
||||
interface EcKeyAlgorithm extends KeyAlgorithm {
|
||||
@@ -18330,6 +18360,13 @@ interface JsonWebKey {
|
||||
k?: string;
|
||||
}
|
||||
|
||||
interface ParentNode {
|
||||
readonly children: HTMLCollection;
|
||||
readonly firstElementChild: Element;
|
||||
readonly lastElementChild: Element;
|
||||
readonly childElementCount: number;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
@@ -18400,7 +18437,7 @@ declare var location: Location;
|
||||
declare var locationbar: BarProp;
|
||||
declare var menubar: BarProp;
|
||||
declare var msCredentials: MSCredentials;
|
||||
declare var name: string;
|
||||
declare const name: never;
|
||||
declare var navigator: Navigator;
|
||||
declare var offscreenBuffering: string | boolean;
|
||||
declare var onabort: (this: Window, ev: UIEvent) => any;
|
||||
@@ -18494,7 +18531,7 @@ declare var ontouchstart: (ev: TouchEvent) => any;
|
||||
declare var onunload: (this: Window, ev: Event) => any;
|
||||
declare var onvolumechange: (this: Window, ev: Event) => any;
|
||||
declare var onwaiting: (this: Window, ev: Event) => any;
|
||||
declare var opener: Window;
|
||||
declare var opener: any;
|
||||
declare var orientation: string | number;
|
||||
declare var outerHeight: number;
|
||||
declare var outerWidth: number;
|
||||
@@ -18547,6 +18584,9 @@ 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 scroll(options?: ScrollToOptions): void;
|
||||
declare function scrollTo(options?: ScrollToOptions): void;
|
||||
declare function scrollBy(options?: ScrollToOptions): void;
|
||||
declare function toString(): string;
|
||||
declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
declare function dispatchEvent(evt: Event): boolean;
|
||||
@@ -18702,6 +18742,8 @@ type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload;
|
||||
type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete;
|
||||
type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport;
|
||||
type payloadtype = number;
|
||||
type ScrollBehavior = "auto" | "instant" | "smooth";
|
||||
type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
|
||||
type IDBValidKey = number | string | Date | IDBArrayKey;
|
||||
type BufferSource = ArrayBuffer | ArrayBufferView;
|
||||
type MouseWheelEvent = WheelEvent;
|
||||
|
||||
Vendored
+55
-15
@@ -142,6 +142,7 @@ interface KeyAlgorithm {
|
||||
}
|
||||
|
||||
interface KeyboardEventInit extends EventModifierInit {
|
||||
code?: string;
|
||||
key?: string;
|
||||
location?: number;
|
||||
repeat?: boolean;
|
||||
@@ -2304,7 +2305,7 @@ declare var DeviceRotationRate: {
|
||||
new(): DeviceRotationRate;
|
||||
}
|
||||
|
||||
interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent {
|
||||
interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode {
|
||||
/**
|
||||
* Sets or gets the URL for the current document.
|
||||
*/
|
||||
@@ -3367,7 +3368,7 @@ declare var Document: {
|
||||
new(): Document;
|
||||
}
|
||||
|
||||
interface DocumentFragment extends Node, NodeSelector {
|
||||
interface DocumentFragment extends Node, NodeSelector, ParentNode {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -3436,7 +3437,7 @@ declare var EXT_texture_filter_anisotropic: {
|
||||
readonly TEXTURE_MAX_ANISOTROPY_EXT: number;
|
||||
}
|
||||
|
||||
interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode {
|
||||
interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode {
|
||||
readonly classList: DOMTokenList;
|
||||
className: string;
|
||||
readonly clientHeight: number;
|
||||
@@ -3691,6 +3692,16 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
|
||||
getElementsByClassName(classNames: string): NodeListOf<Element>;
|
||||
matches(selector: string): boolean;
|
||||
closest(selector: string): Element | null;
|
||||
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
|
||||
scroll(options?: ScrollToOptions): void;
|
||||
scroll(x: number, y: number): void;
|
||||
scrollTo(options?: ScrollToOptions): void;
|
||||
scrollTo(x: number, y: number): void;
|
||||
scrollBy(options?: ScrollToOptions): void;
|
||||
scrollBy(x: number, y: number): void;
|
||||
insertAdjacentElement(position: string, insertedElement: Element): Element | null;
|
||||
insertAdjacentHTML(where: string, html: string): void;
|
||||
insertAdjacentText(where: string, text: string): void;
|
||||
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -4462,7 +4473,7 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
|
||||
*/
|
||||
toDataURL(type?: string, ...args: any[]): string;
|
||||
toBlob(callback: (result: Blob | null) => void, ... arguments: any[]): void;
|
||||
toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void;
|
||||
}
|
||||
|
||||
declare var HTMLCanvasElement: {
|
||||
@@ -4637,11 +4648,7 @@ interface HTMLElement extends Element {
|
||||
click(): void;
|
||||
dragDrop(): boolean;
|
||||
focus(): void;
|
||||
insertAdjacentElement(position: string, insertedElement: Element): Element;
|
||||
insertAdjacentHTML(where: string, html: string): void;
|
||||
insertAdjacentText(where: string, text: string): void;
|
||||
msGetInputContext(): MSInputMethodContext;
|
||||
scrollIntoView(top?: boolean): void;
|
||||
setActive(): void;
|
||||
addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -5906,6 +5913,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle {
|
||||
*/
|
||||
type: string;
|
||||
import?: Document;
|
||||
integrity: string;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -6194,7 +6202,7 @@ interface HTMLMediaElement extends HTMLElement {
|
||||
*/
|
||||
canPlayType(type: string): string;
|
||||
/**
|
||||
* Fires immediately after the client loads the object.
|
||||
* Resets the audio or video object and loads a new media resource.
|
||||
*/
|
||||
load(): void;
|
||||
/**
|
||||
@@ -6767,6 +6775,7 @@ interface HTMLScriptElement extends HTMLElement {
|
||||
* Sets or retrieves the MIME type for the associated scripting engine.
|
||||
*/
|
||||
type: string;
|
||||
integrity: string;
|
||||
}
|
||||
|
||||
declare var HTMLScriptElement: {
|
||||
@@ -7772,6 +7781,7 @@ interface KeyboardEvent extends UIEvent {
|
||||
readonly repeat: boolean;
|
||||
readonly shiftKey: boolean;
|
||||
readonly which: number;
|
||||
readonly code: string;
|
||||
getModifierState(keyArg: string): boolean;
|
||||
initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void;
|
||||
readonly DOM_KEY_LOCATION_JOYSTICK: number;
|
||||
@@ -9144,6 +9154,7 @@ interface PerformanceTiming {
|
||||
readonly responseStart: number;
|
||||
readonly unloadEventEnd: number;
|
||||
readonly unloadEventStart: number;
|
||||
readonly secureConnectionStart: number;
|
||||
toJSON(): any;
|
||||
}
|
||||
|
||||
@@ -11421,8 +11432,8 @@ declare var StereoPannerNode: {
|
||||
interface Storage {
|
||||
readonly length: number;
|
||||
clear(): void;
|
||||
getItem(key: string): string;
|
||||
key(index: number): string;
|
||||
getItem(key: string): string | null;
|
||||
key(index: number): string | null;
|
||||
removeItem(key: string): void;
|
||||
setItem(key: string, data: string): void;
|
||||
[key: string]: any;
|
||||
@@ -12963,7 +12974,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
onunload: (this: this, ev: Event) => any;
|
||||
onvolumechange: (this: this, ev: Event) => any;
|
||||
onwaiting: (this: this, ev: Event) => any;
|
||||
readonly opener: Window;
|
||||
opener: any;
|
||||
orientation: string | number;
|
||||
readonly outerHeight: number;
|
||||
readonly outerWidth: number;
|
||||
@@ -13018,6 +13029,9 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;
|
||||
webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;
|
||||
webkitRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
scroll(options?: ScrollToOptions): void;
|
||||
scrollTo(options?: ScrollToOptions): void;
|
||||
scrollBy(options?: ScrollToOptions): void;
|
||||
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -14045,6 +14059,20 @@ interface ProgressEventInit extends EventInit {
|
||||
total?: number;
|
||||
}
|
||||
|
||||
interface ScrollOptions {
|
||||
behavior?: ScrollBehavior;
|
||||
}
|
||||
|
||||
interface ScrollToOptions extends ScrollOptions {
|
||||
left?: number;
|
||||
top?: number;
|
||||
}
|
||||
|
||||
interface ScrollIntoViewOptions extends ScrollOptions {
|
||||
block?: ScrollLogicalPosition;
|
||||
inline?: ScrollLogicalPosition;
|
||||
}
|
||||
|
||||
interface ClipboardEventInit extends EventInit {
|
||||
data?: string;
|
||||
dataType?: string;
|
||||
@@ -14088,7 +14116,7 @@ interface EcdsaParams extends Algorithm {
|
||||
}
|
||||
|
||||
interface EcKeyGenParams extends Algorithm {
|
||||
typedCurve: string;
|
||||
namedCurve: string;
|
||||
}
|
||||
|
||||
interface EcKeyAlgorithm extends KeyAlgorithm {
|
||||
@@ -14224,6 +14252,13 @@ interface JsonWebKey {
|
||||
k?: string;
|
||||
}
|
||||
|
||||
interface ParentNode {
|
||||
readonly children: HTMLCollection;
|
||||
readonly firstElementChild: Element;
|
||||
readonly lastElementChild: Element;
|
||||
readonly childElementCount: number;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
@@ -14294,7 +14329,7 @@ declare var location: Location;
|
||||
declare var locationbar: BarProp;
|
||||
declare var menubar: BarProp;
|
||||
declare var msCredentials: MSCredentials;
|
||||
declare var name: string;
|
||||
declare const name: never;
|
||||
declare var navigator: Navigator;
|
||||
declare var offscreenBuffering: string | boolean;
|
||||
declare var onabort: (this: Window, ev: UIEvent) => any;
|
||||
@@ -14388,7 +14423,7 @@ declare var ontouchstart: (ev: TouchEvent) => any;
|
||||
declare var onunload: (this: Window, ev: Event) => any;
|
||||
declare var onvolumechange: (this: Window, ev: Event) => any;
|
||||
declare var onwaiting: (this: Window, ev: Event) => any;
|
||||
declare var opener: Window;
|
||||
declare var opener: any;
|
||||
declare var orientation: string | number;
|
||||
declare var outerHeight: number;
|
||||
declare var outerWidth: number;
|
||||
@@ -14441,6 +14476,9 @@ 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 scroll(options?: ScrollToOptions): void;
|
||||
declare function scrollTo(options?: ScrollToOptions): void;
|
||||
declare function scrollBy(options?: ScrollToOptions): void;
|
||||
declare function toString(): string;
|
||||
declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
declare function dispatchEvent(evt: Event): boolean;
|
||||
@@ -14596,6 +14634,8 @@ type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload;
|
||||
type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete;
|
||||
type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport;
|
||||
type payloadtype = number;
|
||||
type ScrollBehavior = "auto" | "instant" | "smooth";
|
||||
type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
|
||||
type IDBValidKey = number | string | Date | IDBArrayKey;
|
||||
type BufferSource = ArrayBuffer | ArrayBufferView;
|
||||
type MouseWheelEvent = WheelEvent;
|
||||
Vendored
+1
-1
@@ -14,7 +14,7 @@ and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
/// <reference path="lib.dom.generated.d.ts" />
|
||||
/// <reference path="lib.dom.d.ts" />
|
||||
|
||||
interface DOMTokenList {
|
||||
[Symbol.iterator](): IterableIterator<string>;
|
||||
|
||||
Vendored
+17
-6
@@ -17,10 +17,10 @@ and limitations under the License.
|
||||
interface Map<K, V> {
|
||||
clear(): void;
|
||||
delete(key: K): boolean;
|
||||
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
|
||||
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
|
||||
get(key: K): V | undefined;
|
||||
has(key: K): boolean;
|
||||
set(key: K, value: V): this;
|
||||
set(key: K, value?: V): this;
|
||||
readonly size: number;
|
||||
}
|
||||
|
||||
@@ -31,12 +31,18 @@ interface MapConstructor {
|
||||
}
|
||||
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;
|
||||
has(key: K): boolean;
|
||||
readonly size: number;
|
||||
}
|
||||
|
||||
interface WeakMap<K, V> {
|
||||
clear(): void;
|
||||
delete(key: K): boolean;
|
||||
get(key: K): V | undefined;
|
||||
has(key: K): boolean;
|
||||
set(key: K, value: V): this;
|
||||
set(key: K, value?: V): this;
|
||||
}
|
||||
|
||||
interface WeakMapConstructor {
|
||||
@@ -50,7 +56,7 @@ interface Set<T> {
|
||||
add(value: T): this;
|
||||
clear(): void;
|
||||
delete(value: T): boolean;
|
||||
forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void;
|
||||
forEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void;
|
||||
has(value: T): boolean;
|
||||
readonly size: number;
|
||||
}
|
||||
@@ -62,9 +68,14 @@ interface SetConstructor {
|
||||
}
|
||||
declare var Set: SetConstructor;
|
||||
|
||||
interface ReadonlySet<T> {
|
||||
forEach(callbackfn: (value: T, value2: T, set: ReadonlySet<T>) => void, thisArg?: any): void;
|
||||
has(value: T): boolean;
|
||||
readonly size: number;
|
||||
}
|
||||
|
||||
interface WeakSet<T> {
|
||||
add(value: T): this;
|
||||
clear(): void;
|
||||
delete(value: T): boolean;
|
||||
has(value: T): boolean;
|
||||
}
|
||||
|
||||
Vendored
+32
-4
@@ -29,15 +29,15 @@ interface Array<T> {
|
||||
find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
* 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) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
@@ -84,6 +84,10 @@ interface ArrayConstructor {
|
||||
of<T>(...items: T[]): Array<T>;
|
||||
}
|
||||
|
||||
interface DateConstructor {
|
||||
new (value: Date): Date;
|
||||
}
|
||||
|
||||
interface Function {
|
||||
/**
|
||||
* Returns the name of the function. Function names are read-only and can not be changed.
|
||||
@@ -242,7 +246,7 @@ interface NumberConstructor {
|
||||
/**
|
||||
* 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.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1.
|
||||
* The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1.
|
||||
*/
|
||||
readonly MAX_SAFE_INTEGER: number;
|
||||
|
||||
@@ -359,6 +363,30 @@ interface ObjectConstructor {
|
||||
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 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;
|
||||
}
|
||||
|
||||
interface RegExp {
|
||||
/**
|
||||
* Returns a string indicating the flags of the regular expression in question. This field is read-only.
|
||||
|
||||
Vendored
+20
@@ -79,6 +79,26 @@ interface ArrayConstructor {
|
||||
from<T>(iterable: Iterable<T>): Array<T>;
|
||||
}
|
||||
|
||||
interface ReadonlyArray<T> {
|
||||
/** Iterator */
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<T>;
|
||||
}
|
||||
|
||||
interface IArguments {
|
||||
/** Iterator */
|
||||
[Symbol.iterator](): IterableIterator<any>;
|
||||
|
||||
Vendored
+96
-13
@@ -24,7 +24,7 @@ interface Promise<T> {
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult1, TResult2>(onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
|
||||
then(onfulfilled?: ((value: T) => T | PromiseLike<T>) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): Promise<T>;
|
||||
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
@@ -32,20 +32,30 @@ interface Promise<T> {
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled: (value: T) => TResult | PromiseLike<TResult>, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled: ((value: T) => T | PromiseLike<T>) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>;
|
||||
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled: (value: T) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled: (value: T) => TResult | PromiseLike<TResult>, onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Creates a new Promise with the same internal state of this Promise.
|
||||
* @returns A Promise.
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then(): Promise<T>;
|
||||
then<TResult1, TResult2>(onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of the callback.
|
||||
*/
|
||||
catch(onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): Promise<T>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
@@ -53,13 +63,6 @@ interface Promise<T> {
|
||||
* @returns A Promise for the completion of the callback.
|
||||
*/
|
||||
catch<TResult>(onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of the callback.
|
||||
*/
|
||||
catch(onrejected: (reason: any) => T | PromiseLike<T>): Promise<T>;
|
||||
}
|
||||
|
||||
interface PromiseConstructor {
|
||||
@@ -156,6 +159,86 @@ interface PromiseConstructor {
|
||||
*/
|
||||
all<T>(values: (T | PromiseLike<T>)[]): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<T1 | T2 | T3 | T4 | T5 | T6>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>]): Promise<T1 | T2 | T3 | T4 | T5>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>]): Promise<T1 | T2 | T3 | T4>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<T1 | T2 | T3>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<T1 | T2>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T>(values: (T | PromiseLike<T>)[]): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new rejected promise for the provided reason.
|
||||
* @param reason The reason the promise was rejected.
|
||||
|
||||
Vendored
+2
-2
@@ -19,7 +19,7 @@ interface ProxyHandler<T> {
|
||||
setPrototypeOf? (target: T, v: any): boolean;
|
||||
isExtensible? (target: T): boolean;
|
||||
preventExtensions? (target: T): boolean;
|
||||
getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor | undefined;
|
||||
getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor;
|
||||
has? (target: T, p: PropertyKey): boolean;
|
||||
get? (target: T, p: PropertyKey, receiver: any): any;
|
||||
set? (target: T, p: PropertyKey, value: any, receiver: any): boolean;
|
||||
@@ -35,4 +35,4 @@ interface ProxyConstructor {
|
||||
revocable<T>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
|
||||
new <T>(target: T, handler: ProxyHandler<T>): T
|
||||
}
|
||||
declare var Proxy: ProxyConstructor;
|
||||
declare var Proxy: ProxyConstructor;
|
||||
Vendored
+1
-2
@@ -22,8 +22,7 @@ declare namespace Reflect {
|
||||
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: string): boolean;
|
||||
function has(target: any, propertyKey: symbol): boolean;
|
||||
function has(target: any, propertyKey: PropertyKey): boolean;
|
||||
function isExtensible(target: any): boolean;
|
||||
function ownKeys(target: any): Array<PropertyKey>;
|
||||
function preventExtensions(target: any): boolean;
|
||||
|
||||
Vendored
+95
-93
@@ -529,8 +529,8 @@ interface NumberConstructor {
|
||||
/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */
|
||||
declare const Number: NumberConstructor;
|
||||
|
||||
interface TemplateStringsArray extends Array<string> {
|
||||
readonly raw: string[];
|
||||
interface TemplateStringsArray extends ReadonlyArray<string> {
|
||||
readonly raw: ReadonlyArray<string>
|
||||
}
|
||||
|
||||
interface Math {
|
||||
@@ -1022,7 +1022,12 @@ interface ReadonlyArray<T> {
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
*/
|
||||
concat(...items: T[]): T[];
|
||||
concat(...items: T[][]): T[];
|
||||
/**
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
*/
|
||||
concat(...items: (T | T[])[]): T[];
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
|
||||
@@ -1071,6 +1076,12 @@ interface ReadonlyArray<T> {
|
||||
* @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.
|
||||
*/
|
||||
map<U>(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => U, thisArg?: any): U[];
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
filter<S extends T>(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => value is S, thisArg?: any): S[];
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
|
||||
@@ -1124,6 +1135,11 @@ interface Array<T> {
|
||||
* Removes the last element from an array and returns it.
|
||||
*/
|
||||
pop(): T | undefined;
|
||||
/**
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
*/
|
||||
concat(...items: T[][]): T[];
|
||||
/**
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
@@ -1271,13 +1287,44 @@ declare type PromiseConstructorLike = new <T>(executor: (resolve: (value?: T | P
|
||||
|
||||
interface PromiseLike<T> {
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then(
|
||||
onfulfilled?: ((value: T) => T | PromiseLike<T>) | undefined | null,
|
||||
onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): PromiseLike<T>;
|
||||
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(
|
||||
onfulfilled: ((value: T) => T | PromiseLike<T>) | undefined | null,
|
||||
onrejected: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<T | TResult>;
|
||||
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(
|
||||
onfulfilled: (value: T) => TResult | PromiseLike<TResult>,
|
||||
onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): PromiseLike<TResult>;
|
||||
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult1, TResult2>(
|
||||
onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>,
|
||||
onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): PromiseLike<TResult1 | TResult2>;
|
||||
}
|
||||
|
||||
interface ArrayLike<T> {
|
||||
@@ -1537,7 +1584,7 @@ interface Int8Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -1545,7 +1592,7 @@ interface Int8Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -1810,7 +1857,7 @@ interface Uint8Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -1818,7 +1865,7 @@ interface Uint8Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -2084,7 +2131,7 @@ interface Uint8ClampedArray {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -2092,7 +2139,7 @@ interface Uint8ClampedArray {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -2357,7 +2404,7 @@ interface Int16Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -2365,7 +2412,7 @@ interface Int16Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -2631,7 +2678,7 @@ interface Uint16Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -2639,7 +2686,7 @@ interface Uint16Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -2904,7 +2951,7 @@ interface Int32Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -2912,7 +2959,7 @@ interface Int32Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -3177,7 +3224,7 @@ interface Uint32Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -3185,7 +3232,7 @@ interface Uint32Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -3450,7 +3497,7 @@ interface Float32Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -3458,7 +3505,7 @@ interface Float32Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -3724,7 +3771,7 @@ interface Float64Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -3732,7 +3779,7 @@ interface Float64Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -3949,12 +3996,9 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedCollatorOptions;
|
||||
}
|
||||
var Collator: {
|
||||
new (locales?: string[], options?: CollatorOptions): Collator;
|
||||
new (locale?: string, options?: CollatorOptions): Collator;
|
||||
(locales?: string[], options?: CollatorOptions): Collator;
|
||||
(locale?: string, options?: CollatorOptions): Collator;
|
||||
supportedLocalesOf(locales: string[], options?: CollatorOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: CollatorOptions): string[];
|
||||
new (locales?: string | string[], options?: CollatorOptions): Collator;
|
||||
(locales?: string | string[], options?: CollatorOptions): Collator;
|
||||
supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[];
|
||||
}
|
||||
|
||||
interface NumberFormatOptions {
|
||||
@@ -3989,12 +4033,9 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedNumberFormatOptions;
|
||||
}
|
||||
var NumberFormat: {
|
||||
new (locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
new (locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
(locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
(locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];
|
||||
new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
|
||||
(locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
|
||||
supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[];
|
||||
}
|
||||
|
||||
interface DateTimeFormatOptions {
|
||||
@@ -4035,88 +4076,49 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedDateTimeFormatOptions;
|
||||
}
|
||||
var DateTimeFormat: {
|
||||
new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];
|
||||
new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[];
|
||||
}
|
||||
}
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Determines whether two strings are equivalent in the current locale.
|
||||
* Determines whether two strings are equivalent in the current or specified locale.
|
||||
* @param that String to compare to target string
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
|
||||
* @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
|
||||
*/
|
||||
localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number;
|
||||
|
||||
/**
|
||||
* Determines whether two strings are equivalent in the current locale.
|
||||
* @param that String to compare to target string
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
|
||||
* @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
|
||||
*/
|
||||
localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number;
|
||||
localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number;
|
||||
}
|
||||
|
||||
interface Number {
|
||||
/**
|
||||
* Converts a number to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a number to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string;
|
||||
toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;
|
||||
}
|
||||
|
||||
interface Date {
|
||||
/**
|
||||
* Converts a date and time to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date and time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
}
|
||||
|
||||
Vendored
+315
-132
@@ -529,8 +529,8 @@ interface NumberConstructor {
|
||||
/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */
|
||||
declare const Number: NumberConstructor;
|
||||
|
||||
interface TemplateStringsArray extends Array<string> {
|
||||
readonly raw: string[];
|
||||
interface TemplateStringsArray extends ReadonlyArray<string> {
|
||||
readonly raw: ReadonlyArray<string>
|
||||
}
|
||||
|
||||
interface Math {
|
||||
@@ -1022,7 +1022,12 @@ interface ReadonlyArray<T> {
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
*/
|
||||
concat(...items: T[]): T[];
|
||||
concat(...items: T[][]): T[];
|
||||
/**
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
*/
|
||||
concat(...items: (T | T[])[]): T[];
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
|
||||
@@ -1071,6 +1076,12 @@ interface ReadonlyArray<T> {
|
||||
* @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.
|
||||
*/
|
||||
map<U>(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => U, thisArg?: any): U[];
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
filter<S extends T>(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => value is S, thisArg?: any): S[];
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
|
||||
@@ -1124,6 +1135,11 @@ interface Array<T> {
|
||||
* Removes the last element from an array and returns it.
|
||||
*/
|
||||
pop(): T | undefined;
|
||||
/**
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
*/
|
||||
concat(...items: T[][]): T[];
|
||||
/**
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
@@ -1271,13 +1287,44 @@ declare type PromiseConstructorLike = new <T>(executor: (resolve: (value?: T | P
|
||||
|
||||
interface PromiseLike<T> {
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then(
|
||||
onfulfilled?: ((value: T) => T | PromiseLike<T>) | undefined | null,
|
||||
onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): PromiseLike<T>;
|
||||
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(
|
||||
onfulfilled: ((value: T) => T | PromiseLike<T>) | undefined | null,
|
||||
onrejected: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<T | TResult>;
|
||||
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(
|
||||
onfulfilled: (value: T) => TResult | PromiseLike<TResult>,
|
||||
onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): PromiseLike<TResult>;
|
||||
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult1, TResult2>(
|
||||
onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>,
|
||||
onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): PromiseLike<TResult1 | TResult2>;
|
||||
}
|
||||
|
||||
interface ArrayLike<T> {
|
||||
@@ -1537,7 +1584,7 @@ interface Int8Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -1545,7 +1592,7 @@ interface Int8Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -1810,7 +1857,7 @@ interface Uint8Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -1818,7 +1865,7 @@ interface Uint8Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -2084,7 +2131,7 @@ interface Uint8ClampedArray {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -2092,7 +2139,7 @@ interface Uint8ClampedArray {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -2357,7 +2404,7 @@ interface Int16Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -2365,7 +2412,7 @@ interface Int16Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -2631,7 +2678,7 @@ interface Uint16Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -2639,7 +2686,7 @@ interface Uint16Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -2904,7 +2951,7 @@ interface Int32Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -2912,7 +2959,7 @@ interface Int32Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -3177,7 +3224,7 @@ interface Uint32Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -3185,7 +3232,7 @@ interface Uint32Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -3450,7 +3497,7 @@ interface Float32Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -3458,7 +3505,7 @@ interface Float32Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -3724,7 +3771,7 @@ interface Float64Array {
|
||||
find(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
@@ -3732,7 +3779,7 @@ interface Float64Array {
|
||||
* @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: number) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: number, index: number, obj: Array<number>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
@@ -3949,12 +3996,9 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedCollatorOptions;
|
||||
}
|
||||
var Collator: {
|
||||
new (locales?: string[], options?: CollatorOptions): Collator;
|
||||
new (locale?: string, options?: CollatorOptions): Collator;
|
||||
(locales?: string[], options?: CollatorOptions): Collator;
|
||||
(locale?: string, options?: CollatorOptions): Collator;
|
||||
supportedLocalesOf(locales: string[], options?: CollatorOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: CollatorOptions): string[];
|
||||
new (locales?: string | string[], options?: CollatorOptions): Collator;
|
||||
(locales?: string | string[], options?: CollatorOptions): Collator;
|
||||
supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[];
|
||||
}
|
||||
|
||||
interface NumberFormatOptions {
|
||||
@@ -3989,12 +4033,9 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedNumberFormatOptions;
|
||||
}
|
||||
var NumberFormat: {
|
||||
new (locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
new (locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
(locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
(locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];
|
||||
new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
|
||||
(locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
|
||||
supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[];
|
||||
}
|
||||
|
||||
interface DateTimeFormatOptions {
|
||||
@@ -4035,90 +4076,51 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedDateTimeFormatOptions;
|
||||
}
|
||||
var DateTimeFormat: {
|
||||
new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];
|
||||
new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[];
|
||||
}
|
||||
}
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Determines whether two strings are equivalent in the current locale.
|
||||
* Determines whether two strings are equivalent in the current or specified locale.
|
||||
* @param that String to compare to target string
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
|
||||
* @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
|
||||
*/
|
||||
localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number;
|
||||
|
||||
/**
|
||||
* Determines whether two strings are equivalent in the current locale.
|
||||
* @param that String to compare to target string
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
|
||||
* @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
|
||||
*/
|
||||
localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number;
|
||||
localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number;
|
||||
}
|
||||
|
||||
interface Number {
|
||||
/**
|
||||
* Converts a number to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a number to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string;
|
||||
toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;
|
||||
}
|
||||
|
||||
interface Date {
|
||||
/**
|
||||
* Converts a date and time to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date and time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a date to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
|
||||
/**
|
||||
* Converts a time to a string by using the current or specified locale.
|
||||
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
||||
* @param options An object that contains one or more properties that specify comparison options.
|
||||
*/
|
||||
toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
||||
toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
|
||||
}
|
||||
declare type PropertyKey = string | number | symbol;
|
||||
|
||||
@@ -4135,15 +4137,15 @@ interface Array<T> {
|
||||
find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and 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,
|
||||
* 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) => boolean, thisArg?: any): number;
|
||||
findIndex(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
@@ -4190,6 +4192,10 @@ interface ArrayConstructor {
|
||||
of<T>(...items: T[]): Array<T>;
|
||||
}
|
||||
|
||||
interface DateConstructor {
|
||||
new (value: Date): Date;
|
||||
}
|
||||
|
||||
interface Function {
|
||||
/**
|
||||
* Returns the name of the function. Function names are read-only and can not be changed.
|
||||
@@ -4348,7 +4354,7 @@ interface NumberConstructor {
|
||||
/**
|
||||
* 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.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1.
|
||||
* The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1.
|
||||
*/
|
||||
readonly MAX_SAFE_INTEGER: number;
|
||||
|
||||
@@ -4465,6 +4471,30 @@ interface ObjectConstructor {
|
||||
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 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;
|
||||
}
|
||||
|
||||
interface RegExp {
|
||||
/**
|
||||
* Returns a string indicating the flags of the regular expression in question. This field is read-only.
|
||||
@@ -4619,7 +4649,7 @@ interface StringConstructor {
|
||||
interface Map<K, V> {
|
||||
clear(): void;
|
||||
delete(key: K): boolean;
|
||||
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
|
||||
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
|
||||
get(key: K): V | undefined;
|
||||
has(key: K): boolean;
|
||||
set(key: K, value?: V): this;
|
||||
@@ -4633,8 +4663,14 @@ interface MapConstructor {
|
||||
}
|
||||
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;
|
||||
has(key: K): boolean;
|
||||
readonly size: number;
|
||||
}
|
||||
|
||||
interface WeakMap<K, V> {
|
||||
clear(): void;
|
||||
delete(key: K): boolean;
|
||||
get(key: K): V | undefined;
|
||||
has(key: K): boolean;
|
||||
@@ -4652,7 +4688,7 @@ interface Set<T> {
|
||||
add(value: T): this;
|
||||
clear(): void;
|
||||
delete(value: T): boolean;
|
||||
forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void;
|
||||
forEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void;
|
||||
has(value: T): boolean;
|
||||
readonly size: number;
|
||||
}
|
||||
@@ -4664,9 +4700,14 @@ interface SetConstructor {
|
||||
}
|
||||
declare var Set: SetConstructor;
|
||||
|
||||
interface ReadonlySet<T> {
|
||||
forEach(callbackfn: (value: T, value2: T, set: ReadonlySet<T>) => void, thisArg?: any): void;
|
||||
has(value: T): boolean;
|
||||
readonly size: number;
|
||||
}
|
||||
|
||||
interface WeakSet<T> {
|
||||
add(value: T): this;
|
||||
clear(): void;
|
||||
delete(value: T): boolean;
|
||||
has(value: T): boolean;
|
||||
}
|
||||
@@ -4754,6 +4795,26 @@ interface ArrayConstructor {
|
||||
from<T>(iterable: Iterable<T>): Array<T>;
|
||||
}
|
||||
|
||||
interface ReadonlyArray<T> {
|
||||
/** Iterator */
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<T>;
|
||||
}
|
||||
|
||||
interface IArguments {
|
||||
/** Iterator */
|
||||
[Symbol.iterator](): IterableIterator<any>;
|
||||
@@ -5123,7 +5184,7 @@ interface Promise<T> {
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult1, TResult2>(onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
|
||||
then(onfulfilled?: ((value: T) => T | PromiseLike<T>) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): Promise<T>;
|
||||
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
@@ -5131,20 +5192,30 @@ interface Promise<T> {
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled: (value: T) => TResult | PromiseLike<TResult>, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled: ((value: T) => T | PromiseLike<T>) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>;
|
||||
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled: (value: T) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled: (value: T) => TResult | PromiseLike<TResult>, onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Creates a new Promise with the same internal state of this Promise.
|
||||
* @returns A Promise.
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then(): Promise<T>;
|
||||
then<TResult1, TResult2>(onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of the callback.
|
||||
*/
|
||||
catch(onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): Promise<T>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
@@ -5152,13 +5223,6 @@ interface Promise<T> {
|
||||
* @returns A Promise for the completion of the callback.
|
||||
*/
|
||||
catch<TResult>(onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of the callback.
|
||||
*/
|
||||
catch(onrejected: (reason: any) => T | PromiseLike<T>): Promise<T>;
|
||||
}
|
||||
|
||||
interface PromiseConstructor {
|
||||
@@ -5255,6 +5319,86 @@ interface PromiseConstructor {
|
||||
*/
|
||||
all<T>(values: (T | PromiseLike<T>)[]): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<T1 | T2 | T3 | T4 | T5 | T6>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>]): Promise<T1 | T2 | T3 | T4 | T5>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>]): Promise<T1 | T2 | T3 | T4>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<T1 | T2 | T3>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<T1 | T2>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T>(values: (T | PromiseLike<T>)[]): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new rejected promise for the provided reason.
|
||||
* @param reason The reason the promise was rejected.
|
||||
@@ -5312,8 +5456,7 @@ declare var Proxy: ProxyConstructor;declare namespace Reflect {
|
||||
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: string): boolean;
|
||||
function has(target: any, propertyKey: symbol): boolean;
|
||||
function has(target: any, propertyKey: PropertyKey): boolean;
|
||||
function isExtensible(target: any): boolean;
|
||||
function ownKeys(target: any): Array<PropertyKey>;
|
||||
function preventExtensions(target: any): boolean;
|
||||
@@ -5808,6 +5951,7 @@ interface KeyAlgorithm {
|
||||
}
|
||||
|
||||
interface KeyboardEventInit extends EventModifierInit {
|
||||
code?: string;
|
||||
key?: string;
|
||||
location?: number;
|
||||
repeat?: boolean;
|
||||
@@ -7970,7 +8114,7 @@ declare var DeviceRotationRate: {
|
||||
new(): DeviceRotationRate;
|
||||
}
|
||||
|
||||
interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent {
|
||||
interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode {
|
||||
/**
|
||||
* Sets or gets the URL for the current document.
|
||||
*/
|
||||
@@ -9033,7 +9177,7 @@ declare var Document: {
|
||||
new(): Document;
|
||||
}
|
||||
|
||||
interface DocumentFragment extends Node, NodeSelector {
|
||||
interface DocumentFragment extends Node, NodeSelector, ParentNode {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -9102,7 +9246,7 @@ declare var EXT_texture_filter_anisotropic: {
|
||||
readonly TEXTURE_MAX_ANISOTROPY_EXT: number;
|
||||
}
|
||||
|
||||
interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode {
|
||||
interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode {
|
||||
readonly classList: DOMTokenList;
|
||||
className: string;
|
||||
readonly clientHeight: number;
|
||||
@@ -9357,6 +9501,16 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
|
||||
getElementsByClassName(classNames: string): NodeListOf<Element>;
|
||||
matches(selector: string): boolean;
|
||||
closest(selector: string): Element | null;
|
||||
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
|
||||
scroll(options?: ScrollToOptions): void;
|
||||
scroll(x: number, y: number): void;
|
||||
scrollTo(options?: ScrollToOptions): void;
|
||||
scrollTo(x: number, y: number): void;
|
||||
scrollBy(options?: ScrollToOptions): void;
|
||||
scrollBy(x: number, y: number): void;
|
||||
insertAdjacentElement(position: string, insertedElement: Element): Element | null;
|
||||
insertAdjacentHTML(where: string, html: string): void;
|
||||
insertAdjacentText(where: string, text: string): void;
|
||||
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -10128,7 +10282,7 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
|
||||
*/
|
||||
toDataURL(type?: string, ...args: any[]): string;
|
||||
toBlob(callback: (result: Blob | null) => void, ... arguments: any[]): void;
|
||||
toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void;
|
||||
}
|
||||
|
||||
declare var HTMLCanvasElement: {
|
||||
@@ -10303,11 +10457,7 @@ interface HTMLElement extends Element {
|
||||
click(): void;
|
||||
dragDrop(): boolean;
|
||||
focus(): void;
|
||||
insertAdjacentElement(position: string, insertedElement: Element): Element;
|
||||
insertAdjacentHTML(where: string, html: string): void;
|
||||
insertAdjacentText(where: string, text: string): void;
|
||||
msGetInputContext(): MSInputMethodContext;
|
||||
scrollIntoView(top?: boolean): void;
|
||||
setActive(): void;
|
||||
addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -11572,6 +11722,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle {
|
||||
*/
|
||||
type: string;
|
||||
import?: Document;
|
||||
integrity: string;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -11860,7 +12011,7 @@ interface HTMLMediaElement extends HTMLElement {
|
||||
*/
|
||||
canPlayType(type: string): string;
|
||||
/**
|
||||
* Fires immediately after the client loads the object.
|
||||
* Resets the audio or video object and loads a new media resource.
|
||||
*/
|
||||
load(): void;
|
||||
/**
|
||||
@@ -12433,6 +12584,7 @@ interface HTMLScriptElement extends HTMLElement {
|
||||
* Sets or retrieves the MIME type for the associated scripting engine.
|
||||
*/
|
||||
type: string;
|
||||
integrity: string;
|
||||
}
|
||||
|
||||
declare var HTMLScriptElement: {
|
||||
@@ -13438,6 +13590,7 @@ interface KeyboardEvent extends UIEvent {
|
||||
readonly repeat: boolean;
|
||||
readonly shiftKey: boolean;
|
||||
readonly which: number;
|
||||
readonly code: string;
|
||||
getModifierState(keyArg: string): boolean;
|
||||
initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void;
|
||||
readonly DOM_KEY_LOCATION_JOYSTICK: number;
|
||||
@@ -14810,6 +14963,7 @@ interface PerformanceTiming {
|
||||
readonly responseStart: number;
|
||||
readonly unloadEventEnd: number;
|
||||
readonly unloadEventStart: number;
|
||||
readonly secureConnectionStart: number;
|
||||
toJSON(): any;
|
||||
}
|
||||
|
||||
@@ -17087,8 +17241,8 @@ declare var StereoPannerNode: {
|
||||
interface Storage {
|
||||
readonly length: number;
|
||||
clear(): void;
|
||||
getItem(key: string): string;
|
||||
key(index: number): string;
|
||||
getItem(key: string): string | null;
|
||||
key(index: number): string | null;
|
||||
removeItem(key: string): void;
|
||||
setItem(key: string, data: string): void;
|
||||
[key: string]: any;
|
||||
@@ -18629,7 +18783,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
onunload: (this: this, ev: Event) => any;
|
||||
onvolumechange: (this: this, ev: Event) => any;
|
||||
onwaiting: (this: this, ev: Event) => any;
|
||||
readonly opener: Window;
|
||||
opener: any;
|
||||
orientation: string | number;
|
||||
readonly outerHeight: number;
|
||||
readonly outerWidth: number;
|
||||
@@ -18684,6 +18838,9 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;
|
||||
webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;
|
||||
webkitRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
scroll(options?: ScrollToOptions): void;
|
||||
scrollTo(options?: ScrollToOptions): void;
|
||||
scrollBy(options?: ScrollToOptions): void;
|
||||
addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -19711,6 +19868,20 @@ interface ProgressEventInit extends EventInit {
|
||||
total?: number;
|
||||
}
|
||||
|
||||
interface ScrollOptions {
|
||||
behavior?: ScrollBehavior;
|
||||
}
|
||||
|
||||
interface ScrollToOptions extends ScrollOptions {
|
||||
left?: number;
|
||||
top?: number;
|
||||
}
|
||||
|
||||
interface ScrollIntoViewOptions extends ScrollOptions {
|
||||
block?: ScrollLogicalPosition;
|
||||
inline?: ScrollLogicalPosition;
|
||||
}
|
||||
|
||||
interface ClipboardEventInit extends EventInit {
|
||||
data?: string;
|
||||
dataType?: string;
|
||||
@@ -19754,7 +19925,7 @@ interface EcdsaParams extends Algorithm {
|
||||
}
|
||||
|
||||
interface EcKeyGenParams extends Algorithm {
|
||||
typedCurve: string;
|
||||
namedCurve: string;
|
||||
}
|
||||
|
||||
interface EcKeyAlgorithm extends KeyAlgorithm {
|
||||
@@ -19890,6 +20061,13 @@ interface JsonWebKey {
|
||||
k?: string;
|
||||
}
|
||||
|
||||
interface ParentNode {
|
||||
readonly children: HTMLCollection;
|
||||
readonly firstElementChild: Element;
|
||||
readonly lastElementChild: Element;
|
||||
readonly childElementCount: number;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
@@ -19960,7 +20138,7 @@ declare var location: Location;
|
||||
declare var locationbar: BarProp;
|
||||
declare var menubar: BarProp;
|
||||
declare var msCredentials: MSCredentials;
|
||||
declare var name: string;
|
||||
declare const name: never;
|
||||
declare var navigator: Navigator;
|
||||
declare var offscreenBuffering: string | boolean;
|
||||
declare var onabort: (this: Window, ev: UIEvent) => any;
|
||||
@@ -20054,7 +20232,7 @@ declare var ontouchstart: (ev: TouchEvent) => any;
|
||||
declare var onunload: (this: Window, ev: Event) => any;
|
||||
declare var onvolumechange: (this: Window, ev: Event) => any;
|
||||
declare var onwaiting: (this: Window, ev: Event) => any;
|
||||
declare var opener: Window;
|
||||
declare var opener: any;
|
||||
declare var orientation: string | number;
|
||||
declare var outerHeight: number;
|
||||
declare var outerWidth: number;
|
||||
@@ -20107,6 +20285,9 @@ 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 scroll(options?: ScrollToOptions): void;
|
||||
declare function scrollTo(options?: ScrollToOptions): void;
|
||||
declare function scrollBy(options?: ScrollToOptions): void;
|
||||
declare function toString(): string;
|
||||
declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
declare function dispatchEvent(evt: Event): boolean;
|
||||
@@ -20262,6 +20443,8 @@ type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload;
|
||||
type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete;
|
||||
type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport;
|
||||
type payloadtype = number;
|
||||
type ScrollBehavior = "auto" | "instant" | "smooth";
|
||||
type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
|
||||
type IDBValidKey = number | string | Date | IDBArrayKey;
|
||||
type BufferSource = ArrayBuffer | ArrayBufferView;
|
||||
type MouseWheelEvent = WheelEvent;
|
||||
@@ -20561,7 +20744,7 @@ interface DateConstructor {
|
||||
interface Date {
|
||||
getVarDate: () => VarDate;
|
||||
}
|
||||
/// <reference path="lib.dom.generated.d.ts" />
|
||||
/// <reference path="lib.dom.d.ts" />
|
||||
|
||||
interface DOMTokenList {
|
||||
[Symbol.iterator](): IterableIterator<string>;
|
||||
|
||||
Vendored
+1
-1
@@ -1016,7 +1016,7 @@ interface EcdsaParams extends Algorithm {
|
||||
}
|
||||
|
||||
interface EcKeyGenParams extends Algorithm {
|
||||
typedCurve: string;
|
||||
namedCurve: string;
|
||||
}
|
||||
|
||||
interface EcKeyAlgorithm extends KeyAlgorithm {
|
||||
|
||||
+19074
-9377
File diff suppressed because it is too large
Load Diff
+26128
-15512
File diff suppressed because it is too large
Load Diff
Vendored
+1801
-841
File diff suppressed because it is too large
Load Diff
+26124
-15508
File diff suppressed because it is too large
Load Diff
Vendored
+378
-244
File diff suppressed because it is too large
Load Diff
+32669
-17578
File diff suppressed because it is too large
Load Diff
Vendored
+378
-244
File diff suppressed because it is too large
Load Diff
+32669
-17578
File diff suppressed because it is too large
Load Diff
+204
-80
@@ -2016,6 +2016,10 @@ namespace ts {
|
||||
isExternalModuleAugmentation(node.parent.parent);
|
||||
}
|
||||
|
||||
function literalTypeToString(type: LiteralType) {
|
||||
return type.flags & TypeFlags.StringLiteral ? `"${escapeString((<LiteralType>type).text)}"` : (<LiteralType>type).text;
|
||||
}
|
||||
|
||||
function getSymbolDisplayBuilder(): SymbolDisplayBuilder {
|
||||
|
||||
function getNameOfSymbol(symbol: Symbol): string {
|
||||
@@ -2191,11 +2195,8 @@ namespace ts {
|
||||
else if (type.flags & TypeFlags.Anonymous) {
|
||||
writeAnonymousType(<ObjectType>type, nextFlags);
|
||||
}
|
||||
else if (type.flags & TypeFlags.StringLiteral) {
|
||||
writer.writeStringLiteral(`"${escapeString((<LiteralType>type).text)}"`);
|
||||
}
|
||||
else if (type.flags & TypeFlags.NumberLiteral) {
|
||||
writer.writeStringLiteral((<LiteralType>type).text);
|
||||
else if (type.flags & TypeFlags.StringOrNumberLiteral) {
|
||||
writer.writeStringLiteral(literalTypeToString(<LiteralType>type));
|
||||
}
|
||||
else {
|
||||
// Should never get here
|
||||
@@ -2747,8 +2748,9 @@ namespace ts {
|
||||
|
||||
// Type parameters are always visible
|
||||
case SyntaxKind.TypeParameter:
|
||||
// Source file is always visible
|
||||
// Source file and namespace export are always visible
|
||||
case SyntaxKind.SourceFile:
|
||||
case SyntaxKind.NamespaceExportDeclaration:
|
||||
return true;
|
||||
|
||||
// Export assignments do not create name bindings outside the module
|
||||
@@ -3846,6 +3848,14 @@ namespace ts {
|
||||
return true;
|
||||
}
|
||||
|
||||
function createEnumLiteralType(symbol: Symbol, baseType: EnumType, text: string) {
|
||||
const type = <EnumLiteralType>createType(TypeFlags.EnumLiteral);
|
||||
type.symbol = symbol;
|
||||
type.baseType = <EnumType & UnionType>baseType;
|
||||
type.text = text;
|
||||
return type;
|
||||
}
|
||||
|
||||
function getDeclaredTypeOfEnum(symbol: Symbol): Type {
|
||||
const links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
@@ -3861,10 +3871,7 @@ namespace ts {
|
||||
const memberSymbol = getSymbolOfNode(member);
|
||||
const value = getEnumMemberValue(member);
|
||||
if (!memberTypes[value]) {
|
||||
const memberType = memberTypes[value] = <EnumLiteralType>createType(TypeFlags.EnumLiteral);
|
||||
memberType.symbol = memberSymbol;
|
||||
memberType.baseType = <EnumType & UnionType>enumType;
|
||||
memberType.text = "" + value;
|
||||
const memberType = memberTypes[value] = createEnumLiteralType(memberSymbol, enumType, "" + value);
|
||||
memberTypeList.push(memberType);
|
||||
}
|
||||
}
|
||||
@@ -4367,7 +4374,7 @@ namespace ts {
|
||||
function getPropertiesOfUnionOrIntersectionType(type: UnionOrIntersectionType): Symbol[] {
|
||||
for (const current of type.types) {
|
||||
for (const prop of getPropertiesOfType(current)) {
|
||||
getPropertyOfUnionOrIntersectionType(type, prop.name);
|
||||
getUnionOrIntersectionProperty(type, prop.name);
|
||||
}
|
||||
// The properties of a union type are those that are present in all constituent types, so
|
||||
// we only need to check the properties of the first type
|
||||
@@ -4375,7 +4382,19 @@ namespace ts {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return type.resolvedProperties ? symbolsToArray(type.resolvedProperties) : emptyArray;
|
||||
const props = type.resolvedProperties;
|
||||
if (props) {
|
||||
const result: Symbol[] = [];
|
||||
for (const key in props) {
|
||||
const prop = props[key];
|
||||
// We need to filter out partial properties in union types
|
||||
if (!(prop.flags & SymbolFlags.SyntheticProperty && (<TransientSymbol>prop).isPartial)) {
|
||||
result.push(prop);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return emptyArray;
|
||||
}
|
||||
|
||||
function getPropertiesOfType(type: Type): Symbol[] {
|
||||
@@ -4428,6 +4447,7 @@ namespace ts {
|
||||
// Flags we want to propagate to the result if they exist in all source symbols
|
||||
let commonFlags = (containingType.flags & TypeFlags.Intersection) ? SymbolFlags.Optional : SymbolFlags.None;
|
||||
let isReadonly = false;
|
||||
let isPartial = false;
|
||||
for (const current of types) {
|
||||
const type = getApparentType(current);
|
||||
if (type !== unknownType) {
|
||||
@@ -4445,21 +4465,20 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else if (containingType.flags & TypeFlags.Union) {
|
||||
// A union type requires the property to be present in all constituent types
|
||||
return undefined;
|
||||
isPartial = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!props) {
|
||||
return undefined;
|
||||
}
|
||||
if (props.length === 1) {
|
||||
if (props.length === 1 && !isPartial) {
|
||||
return props[0];
|
||||
}
|
||||
const propTypes: Type[] = [];
|
||||
const declarations: Declaration[] = [];
|
||||
let commonType: Type = undefined;
|
||||
let hasCommonType = true;
|
||||
let hasNonUniformType = false;
|
||||
for (const prop of props) {
|
||||
if (prop.declarations) {
|
||||
addRange(declarations, prop.declarations);
|
||||
@@ -4469,25 +4488,26 @@ namespace ts {
|
||||
commonType = type;
|
||||
}
|
||||
else if (type !== commonType) {
|
||||
hasCommonType = false;
|
||||
hasNonUniformType = true;
|
||||
}
|
||||
propTypes.push(getTypeOfSymbol(prop));
|
||||
propTypes.push(type);
|
||||
}
|
||||
const result = <TransientSymbol>createSymbol(
|
||||
SymbolFlags.Property |
|
||||
SymbolFlags.Transient |
|
||||
SymbolFlags.SyntheticProperty |
|
||||
commonFlags,
|
||||
name);
|
||||
const result = <TransientSymbol>createSymbol(SymbolFlags.Property | SymbolFlags.Transient | SymbolFlags.SyntheticProperty | commonFlags, name);
|
||||
result.containingType = containingType;
|
||||
result.hasCommonType = hasCommonType;
|
||||
result.hasNonUniformType = hasNonUniformType;
|
||||
result.isPartial = isPartial;
|
||||
result.declarations = declarations;
|
||||
result.isReadonly = isReadonly;
|
||||
result.type = containingType.flags & TypeFlags.Union ? getUnionType(propTypes) : getIntersectionType(propTypes);
|
||||
return result;
|
||||
}
|
||||
|
||||
function getPropertyOfUnionOrIntersectionType(type: UnionOrIntersectionType, name: string): Symbol {
|
||||
// Return the symbol for a given property in a union or intersection type, or undefined if the property
|
||||
// does not exist in any constituent type. Note that the returned property may only be present in some
|
||||
// constituents, in which case the isPartial flag is set when the containing type is union type. We need
|
||||
// these partial properties when identifying discriminant properties, but otherwise they are filtered out
|
||||
// and do not appear to be present in the union type.
|
||||
function getUnionOrIntersectionProperty(type: UnionOrIntersectionType, name: string): Symbol {
|
||||
const properties = type.resolvedProperties || (type.resolvedProperties = createMap<Symbol>());
|
||||
let property = properties[name];
|
||||
if (!property) {
|
||||
@@ -4499,6 +4519,12 @@ namespace ts {
|
||||
return property;
|
||||
}
|
||||
|
||||
function getPropertyOfUnionOrIntersectionType(type: UnionOrIntersectionType, name: string): Symbol {
|
||||
const property = getUnionOrIntersectionProperty(type, name);
|
||||
// We need to filter out partial properties in union types
|
||||
return property && !(property.flags & SymbolFlags.SyntheticProperty && (<TransientSymbol>property).isPartial) ? property : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the symbol for the property with the given name in the given type. Creates synthetic union properties when
|
||||
* necessary, maps primitive types and type parameters are to their apparent types, and augments with properties from
|
||||
@@ -5343,6 +5369,9 @@ namespace ts {
|
||||
containsUndefined?: boolean;
|
||||
containsNull?: boolean;
|
||||
containsNonWideningType?: boolean;
|
||||
containsString?: boolean;
|
||||
containsNumber?: boolean;
|
||||
containsStringOrNumberLiteral?: boolean;
|
||||
}
|
||||
|
||||
function binarySearchTypes(types: Type[], type: Type): number {
|
||||
@@ -5370,22 +5399,26 @@ namespace ts {
|
||||
}
|
||||
|
||||
function addTypeToUnion(typeSet: TypeSet, type: Type) {
|
||||
if (type.flags & TypeFlags.Union) {
|
||||
const flags = type.flags;
|
||||
if (flags & TypeFlags.Union) {
|
||||
addTypesToUnion(typeSet, (<UnionType>type).types);
|
||||
}
|
||||
else if (type.flags & TypeFlags.Any) {
|
||||
else if (flags & TypeFlags.Any) {
|
||||
typeSet.containsAny = true;
|
||||
}
|
||||
else if (!strictNullChecks && type.flags & TypeFlags.Nullable) {
|
||||
if (type.flags & TypeFlags.Undefined) typeSet.containsUndefined = true;
|
||||
if (type.flags & TypeFlags.Null) typeSet.containsNull = true;
|
||||
if (!(type.flags & TypeFlags.ContainsWideningType)) typeSet.containsNonWideningType = true;
|
||||
else if (!strictNullChecks && flags & TypeFlags.Nullable) {
|
||||
if (flags & TypeFlags.Undefined) typeSet.containsUndefined = true;
|
||||
if (flags & TypeFlags.Null) typeSet.containsNull = true;
|
||||
if (!(flags & TypeFlags.ContainsWideningType)) typeSet.containsNonWideningType = true;
|
||||
}
|
||||
else if (!(type.flags & TypeFlags.Never)) {
|
||||
else if (!(flags & TypeFlags.Never)) {
|
||||
if (flags & TypeFlags.String) typeSet.containsString = true;
|
||||
if (flags & TypeFlags.Number) typeSet.containsNumber = true;
|
||||
if (flags & TypeFlags.StringOrNumberLiteral) typeSet.containsStringOrNumberLiteral = true;
|
||||
const len = typeSet.length;
|
||||
const index = len && type.id > typeSet[len - 1].id ? ~len : binarySearchTypes(typeSet, type);
|
||||
if (index < 0) {
|
||||
if (!(type.flags & TypeFlags.Anonymous && type.symbol && type.symbol.flags & (SymbolFlags.Function | SymbolFlags.Method) && containsIdenticalType(typeSet, type))) {
|
||||
if (!(flags & TypeFlags.Anonymous && type.symbol && type.symbol.flags & (SymbolFlags.Function | SymbolFlags.Method) && containsIdenticalType(typeSet, type))) {
|
||||
typeSet.splice(~index, 0, type);
|
||||
}
|
||||
}
|
||||
@@ -5418,7 +5451,7 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
function removeSubtypes(types: Type[]) {
|
||||
function removeSubtypes(types: TypeSet) {
|
||||
let i = types.length;
|
||||
while (i > 0) {
|
||||
i--;
|
||||
@@ -5428,6 +5461,21 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function removeRedundantLiteralTypes(types: TypeSet) {
|
||||
let i = types.length;
|
||||
while (i > 0) {
|
||||
i--;
|
||||
const t = types[i];
|
||||
const remove =
|
||||
t.flags & TypeFlags.StringLiteral && types.containsString ||
|
||||
t.flags & TypeFlags.NumberLiteral && types.containsNumber ||
|
||||
t.flags & TypeFlags.StringOrNumberLiteral && t.flags & TypeFlags.FreshLiteral && containsType(types, (<LiteralType>t).regularType);
|
||||
if (remove) {
|
||||
orderedRemoveItemAt(types, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We sort and deduplicate the constituent types based on object identity. If the subtypeReduction
|
||||
// flag is specified we also reduce the constituent type set to only include types that aren't subtypes
|
||||
// of other types. Subtype reduction is expensive for large union types and is possible only when union
|
||||
@@ -5450,6 +5498,9 @@ namespace ts {
|
||||
if (subtypeReduction) {
|
||||
removeSubtypes(typeSet);
|
||||
}
|
||||
else if (typeSet.containsStringOrNumberLiteral) {
|
||||
removeRedundantLiteralTypes(typeSet);
|
||||
}
|
||||
if (typeSet.length === 0) {
|
||||
return typeSet.containsNull ? typeSet.containsNonWideningType ? nullType : nullWideningType :
|
||||
typeSet.containsUndefined ? typeSet.containsNonWideningType ? undefinedType : undefinedWideningType :
|
||||
@@ -5561,6 +5612,22 @@ namespace ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
function getFreshTypeOfLiteralType(type: Type) {
|
||||
if (type.flags & TypeFlags.StringOrNumberLiteral && !(type.flags & TypeFlags.FreshLiteral)) {
|
||||
if (!(<LiteralType>type).freshType) {
|
||||
const freshType = <LiteralType>createLiteralType(type.flags | TypeFlags.FreshLiteral, (<LiteralType>type).text);
|
||||
freshType.regularType = <LiteralType>type;
|
||||
(<LiteralType>type).freshType = freshType;
|
||||
}
|
||||
return (<LiteralType>type).freshType;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
function getRegularTypeOfLiteralType(type: Type) {
|
||||
return type.flags & TypeFlags.StringOrNumberLiteral && type.flags & TypeFlags.FreshLiteral ? (<LiteralType>type).regularType : type;
|
||||
}
|
||||
|
||||
function getLiteralTypeForText(flags: TypeFlags, text: string) {
|
||||
const map = flags & TypeFlags.StringLiteral ? stringLiteralTypes : numericLiteralTypes;
|
||||
return map[text] || (map[text] = createLiteralType(flags, text));
|
||||
@@ -5569,7 +5636,7 @@ namespace ts {
|
||||
function getTypeFromLiteralTypeNode(node: LiteralTypeNode): Type {
|
||||
const links = getNodeLinks(node);
|
||||
if (!links.resolvedType) {
|
||||
links.resolvedType = checkExpression(node.literal);
|
||||
links.resolvedType = getRegularTypeOfLiteralType(checkExpression(node.literal));
|
||||
}
|
||||
return links.resolvedType;
|
||||
}
|
||||
@@ -5955,7 +6022,7 @@ namespace ts {
|
||||
|
||||
// Returns true if the given expression contains (at any level of nesting) a function or arrow expression
|
||||
// that is subject to contextual typing.
|
||||
function isContextSensitive(node: Expression | MethodDeclaration | ObjectLiteralElement): boolean {
|
||||
function isContextSensitive(node: Expression | MethodDeclaration | ObjectLiteralElementLike): boolean {
|
||||
Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node));
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.FunctionExpression:
|
||||
@@ -6281,7 +6348,7 @@ namespace ts {
|
||||
if ((source.flags & TypeFlags.Number | source.flags & TypeFlags.NumberLiteral) && target.flags & TypeFlags.EnumLike) return true;
|
||||
if (source.flags & TypeFlags.EnumLiteral &&
|
||||
target.flags & TypeFlags.EnumLiteral &&
|
||||
(<LiteralType>source).text === (<LiteralType>target).text &&
|
||||
(<EnumLiteralType>source).text === (<EnumLiteralType>target).text &&
|
||||
isEnumTypeRelatedTo((<EnumLiteralType>source).baseType, (<EnumLiteralType>target).baseType, errorReporter)) {
|
||||
return true;
|
||||
}
|
||||
@@ -6295,6 +6362,12 @@ namespace ts {
|
||||
}
|
||||
|
||||
function isTypeRelatedTo(source: Type, target: Type, relation: Map<RelationComparisonResult>) {
|
||||
if (source.flags & TypeFlags.StringOrNumberLiteral && source.flags & TypeFlags.FreshLiteral) {
|
||||
source = (<LiteralType>source).regularType;
|
||||
}
|
||||
if (target.flags & TypeFlags.StringOrNumberLiteral && target.flags & TypeFlags.FreshLiteral) {
|
||||
target = (<LiteralType>target).regularType;
|
||||
}
|
||||
if (source === target || relation !== identityRelation && isSimpleTypeRelatedTo(source, target, relation)) {
|
||||
return true;
|
||||
}
|
||||
@@ -6392,6 +6465,12 @@ namespace ts {
|
||||
// Ternary.False if they are not related.
|
||||
function isRelatedTo(source: Type, target: Type, reportErrors?: boolean, headMessage?: DiagnosticMessage): Ternary {
|
||||
let result: Ternary;
|
||||
if (source.flags & TypeFlags.StringOrNumberLiteral && source.flags & TypeFlags.FreshLiteral) {
|
||||
source = (<LiteralType>source).regularType;
|
||||
}
|
||||
if (target.flags & TypeFlags.StringOrNumberLiteral && target.flags & TypeFlags.FreshLiteral) {
|
||||
target = (<LiteralType>target).regularType;
|
||||
}
|
||||
// both types are the same - covers 'they are the same primitive type or both are Any' or the same type parameter cases
|
||||
if (source === target) return Ternary.True;
|
||||
|
||||
@@ -6401,7 +6480,7 @@ namespace ts {
|
||||
|
||||
if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined)) return Ternary.True;
|
||||
|
||||
if (source.flags & TypeFlags.FreshObjectLiteral) {
|
||||
if (source.flags & TypeFlags.ObjectLiteral && source.flags & TypeFlags.FreshLiteral) {
|
||||
if (hasExcessProperties(<FreshObjectLiteralType>source, target, reportErrors)) {
|
||||
if (reportErrors) {
|
||||
reportRelationError(headMessage, source, target);
|
||||
@@ -6512,6 +6591,9 @@ namespace ts {
|
||||
if (source.flags & TypeFlags.ObjectType && target.flags & TypeFlags.Primitive) {
|
||||
tryElaborateErrorsForPrimitivesAndObjects(source, target);
|
||||
}
|
||||
else if (source.symbol && source.flags & TypeFlags.ObjectType && globalObjectType === source) {
|
||||
reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
|
||||
}
|
||||
reportRelationError(headMessage, source, target);
|
||||
}
|
||||
return Ternary.False;
|
||||
@@ -7307,6 +7389,15 @@ namespace ts {
|
||||
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(map((<UnionType>type).types, getWidenedLiteralType)) :
|
||||
type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a Type was written as a tuple type literal.
|
||||
* Prefer using isTupleLikeType() unless the use of `elementTypes` is required.
|
||||
@@ -7328,8 +7419,8 @@ namespace ts {
|
||||
// no flags for all other types (including non-falsy literal types).
|
||||
function getFalsyFlags(type: Type): TypeFlags {
|
||||
return type.flags & TypeFlags.Union ? getFalsyFlagsOfTypes((<UnionType>type).types) :
|
||||
type.flags & TypeFlags.StringLiteral ? type === emptyStringType ? TypeFlags.StringLiteral : 0 :
|
||||
type.flags & TypeFlags.NumberLiteral ? type === zeroType ? TypeFlags.NumberLiteral : 0 :
|
||||
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;
|
||||
}
|
||||
@@ -7396,7 +7487,7 @@ namespace ts {
|
||||
* Leave signatures alone since they are not subject to the check.
|
||||
*/
|
||||
function getRegularTypeOfObjectLiteral(type: Type): Type {
|
||||
if (!(type.flags & TypeFlags.FreshObjectLiteral)) {
|
||||
if (!(type.flags & TypeFlags.ObjectLiteral && type.flags & TypeFlags.FreshLiteral)) {
|
||||
return type;
|
||||
}
|
||||
const regularType = (<FreshObjectLiteralType>type).regularType;
|
||||
@@ -7412,7 +7503,7 @@ namespace ts {
|
||||
resolved.constructSignatures,
|
||||
resolved.stringIndexInfo,
|
||||
resolved.numberIndexInfo);
|
||||
regularNew.flags = resolved.flags & ~TypeFlags.FreshObjectLiteral;
|
||||
regularNew.flags = resolved.flags & ~TypeFlags.FreshLiteral;
|
||||
(<FreshObjectLiteralType>type).regularType = regularNew;
|
||||
return regularNew;
|
||||
}
|
||||
@@ -7863,7 +7954,7 @@ namespace ts {
|
||||
const widenLiteralTypes = context.inferences[index].topLevel &&
|
||||
!hasPrimitiveConstraint(signature.typeParameters[index]) &&
|
||||
(context.inferences[index].isFixed || !isTypeParameterAtTopLevel(getReturnTypeOfSignature(signature), signature.typeParameters[index]));
|
||||
const baseInferences = widenLiteralTypes ? map(inferences, getBaseTypeOfLiteralType) : inferences;
|
||||
const baseInferences = widenLiteralTypes ? map(inferences, getWidenedLiteralType) : inferences;
|
||||
// Infer widened union or supertype, or the unknown type for no common supertype
|
||||
const unionOrSuperType = context.inferUnionTypes ? getUnionType(baseInferences, /*subtypeReduction*/ true) : getCommonSupertype(baseInferences);
|
||||
inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : unknownType;
|
||||
@@ -8014,21 +8105,10 @@ namespace ts {
|
||||
|
||||
function isDiscriminantProperty(type: Type, name: string) {
|
||||
if (type && type.flags & TypeFlags.Union) {
|
||||
let prop = getPropertyOfType(type, name);
|
||||
if (!prop) {
|
||||
// The type may be a union that includes nullable or primitive types. If filtering
|
||||
// those out produces a different type, get the property from that type instead.
|
||||
// Effectively, we're checking if this *could* be a discriminant property once nullable
|
||||
// and primitive types are removed by other type guards.
|
||||
const filteredType = getTypeWithFacts(type, TypeFacts.Discriminatable);
|
||||
if (filteredType !== type && filteredType.flags & TypeFlags.Union) {
|
||||
prop = getPropertyOfType(filteredType, name);
|
||||
}
|
||||
}
|
||||
const prop = getUnionOrIntersectionProperty(<UnionType>type, name);
|
||||
if (prop && prop.flags & SymbolFlags.SyntheticProperty) {
|
||||
if ((<TransientSymbol>prop).isDiscriminantProperty === undefined) {
|
||||
(<TransientSymbol>prop).isDiscriminantProperty = !(<TransientSymbol>prop).hasCommonType &&
|
||||
isLiteralType(getTypeOfSymbol(prop));
|
||||
(<TransientSymbol>prop).isDiscriminantProperty = (<TransientSymbol>prop).hasNonUniformType && isLiteralType(getTypeOfSymbol(prop));
|
||||
}
|
||||
return (<TransientSymbol>prop).isDiscriminantProperty;
|
||||
}
|
||||
@@ -8114,14 +8194,14 @@ namespace ts {
|
||||
}
|
||||
if (flags & TypeFlags.StringLiteral) {
|
||||
return strictNullChecks ?
|
||||
type === emptyStringType ? TypeFacts.EmptyStringStrictFacts : TypeFacts.NonEmptyStringStrictFacts :
|
||||
type === emptyStringType ? TypeFacts.EmptyStringFacts : TypeFacts.NonEmptyStringFacts;
|
||||
(<LiteralType>type).text === "" ? TypeFacts.EmptyStringStrictFacts : TypeFacts.NonEmptyStringStrictFacts :
|
||||
(<LiteralType>type).text === "" ? TypeFacts.EmptyStringFacts : TypeFacts.NonEmptyStringFacts;
|
||||
}
|
||||
if (flags & (TypeFlags.Number | TypeFlags.Enum)) {
|
||||
return strictNullChecks ? TypeFacts.NumberStrictFacts : TypeFacts.NumberFacts;
|
||||
}
|
||||
if (flags & (TypeFlags.NumberLiteral | TypeFlags.EnumLiteral)) {
|
||||
const isZero = type === zeroType || type.flags & TypeFlags.EnumLiteral && (<LiteralType>type).text === "0";
|
||||
const isZero = (<LiteralType>type).text === "0";
|
||||
return strictNullChecks ?
|
||||
isZero ? TypeFacts.ZeroStrictFacts : TypeFacts.NonZeroStrictFacts :
|
||||
isZero ? TypeFacts.ZeroFacts : TypeFacts.NonZeroFacts;
|
||||
@@ -8294,7 +8374,7 @@ namespace ts {
|
||||
|
||||
function getTypeOfSwitchClause(clause: CaseClause | DefaultClause) {
|
||||
if (clause.kind === SyntaxKind.CaseClause) {
|
||||
const caseType = checkExpression((<CaseClause>clause).expression);
|
||||
const caseType = getRegularTypeOfLiteralType(checkExpression((<CaseClause>clause).expression));
|
||||
return isUnitType(caseType) ? caseType : undefined;
|
||||
}
|
||||
return neverType;
|
||||
@@ -8680,7 +8760,11 @@ namespace ts {
|
||||
const narrowedType = filterType(type, t => areTypesComparable(t, valueType));
|
||||
return narrowedType.flags & TypeFlags.Never ? type : narrowedType;
|
||||
}
|
||||
return isUnitType(valueType) ? filterType(type, t => t !== valueType) : type;
|
||||
if (isUnitType(valueType)) {
|
||||
const regularType = getRegularTypeOfLiteralType(valueType);
|
||||
return filterType(type, t => getRegularTypeOfLiteralType(t) !== regularType);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
function narrowTypeByTypeof(type: Type, typeOfExpr: TypeOfExpression, operator: SyntaxKind, literal: LiteralExpression, assumeTrue: boolean): Type {
|
||||
@@ -8725,7 +8809,7 @@ namespace ts {
|
||||
if (!hasDefaultClause) {
|
||||
return caseType;
|
||||
}
|
||||
const defaultType = filterType(type, t => !(isUnitType(t) && contains(switchTypes, t)));
|
||||
const defaultType = filterType(type, t => !(isUnitType(t) && contains(switchTypes, getRegularTypeOfLiteralType(t))));
|
||||
return caseType.flags & TypeFlags.Never ? defaultType : getUnionType([caseType, defaultType]);
|
||||
}
|
||||
|
||||
@@ -9569,14 +9653,14 @@ namespace ts {
|
||||
if (parameter.dotDotDotToken) {
|
||||
const restTypes: Type[] = [];
|
||||
for (let i = indexOfParameter; i < iife.arguments.length; i++) {
|
||||
restTypes.push(getBaseTypeOfLiteralType(checkExpression(iife.arguments[i])));
|
||||
restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i])));
|
||||
}
|
||||
return createArrayType(getUnionType(restTypes));
|
||||
}
|
||||
const links = getNodeLinks(iife);
|
||||
const cached = links.resolvedSignature;
|
||||
links.resolvedSignature = anySignature;
|
||||
const type = getBaseTypeOfLiteralType(checkExpression(iife.arguments[indexOfParameter]));
|
||||
const type = getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter]));
|
||||
links.resolvedSignature = cached;
|
||||
return type;
|
||||
}
|
||||
@@ -9811,7 +9895,7 @@ namespace ts {
|
||||
return getContextualTypeForObjectLiteralElement(node);
|
||||
}
|
||||
|
||||
function getContextualTypeForObjectLiteralElement(element: ObjectLiteralElement) {
|
||||
function getContextualTypeForObjectLiteralElement(element: ObjectLiteralElementLike) {
|
||||
const objectLiteral = <ObjectLiteralExpression>element.parent;
|
||||
const type = getApparentTypeOfContextualType(objectLiteral);
|
||||
if (type) {
|
||||
@@ -9928,7 +10012,7 @@ namespace ts {
|
||||
return getContextualTypeForBinaryOperand(node);
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
return getContextualTypeForObjectLiteralElement(<ObjectLiteralElement>parent);
|
||||
return getContextualTypeForObjectLiteralElement(<ObjectLiteralElementLike>parent);
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return getContextualTypeForElementExpression(node);
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
@@ -10308,7 +10392,7 @@ namespace ts {
|
||||
const stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, IndexKind.String) : undefined;
|
||||
const numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, IndexKind.Number) : undefined;
|
||||
const result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);
|
||||
const freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : TypeFlags.FreshObjectLiteral;
|
||||
const freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : TypeFlags.FreshLiteral;
|
||||
result.flags |= TypeFlags.ObjectLiteral | TypeFlags.ContainsObjectLiteral | freshObjectLiteralFlag | (typeFlags & TypeFlags.PropagatingFlags) | (patternWithComputedProperties ? TypeFlags.ObjectLiteralPatternWithComputedProperties : 0);
|
||||
if (inDestructuringPattern) {
|
||||
result.pattern = node;
|
||||
@@ -12678,7 +12762,7 @@ namespace ts {
|
||||
reportErrorsFromWidening(func, type);
|
||||
}
|
||||
if (isUnitType(type) && !(contextualSignature && isLiteralContextualType(getReturnTypeOfSignature(contextualSignature)))) {
|
||||
type = getBaseTypeOfLiteralType(type);
|
||||
type = getWidenedLiteralType(type);
|
||||
}
|
||||
|
||||
const widenedType = getWidenedType(type);
|
||||
@@ -13062,7 +13146,7 @@ namespace ts {
|
||||
return silentNeverType;
|
||||
}
|
||||
if (node.operator === SyntaxKind.MinusToken && node.operand.kind === SyntaxKind.NumericLiteral) {
|
||||
return getLiteralTypeForText(TypeFlags.NumberLiteral, "" + -(<LiteralExpression>node.operand).text);
|
||||
return getFreshTypeOfLiteralType(getLiteralTypeForText(TypeFlags.NumberLiteral, "" + -(<LiteralExpression>node.operand).text));
|
||||
}
|
||||
switch (node.operator) {
|
||||
case SyntaxKind.PlusToken:
|
||||
@@ -13204,7 +13288,7 @@ namespace ts {
|
||||
return sourceType;
|
||||
}
|
||||
|
||||
function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType: Type, property: ObjectLiteralElement, contextualMapper?: TypeMapper) {
|
||||
function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType: Type, property: ObjectLiteralElementLike, contextualMapper?: TypeMapper) {
|
||||
if (property.kind === SyntaxKind.PropertyAssignment || property.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
const name = <PropertyName>(<PropertyAssignment>property).name;
|
||||
if (name.kind === SyntaxKind.ComputedPropertyName) {
|
||||
@@ -13701,12 +13785,13 @@ namespace ts {
|
||||
}
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.StringLiteral:
|
||||
return getLiteralTypeForText(TypeFlags.StringLiteral, (<LiteralExpression>node).text);
|
||||
return getFreshTypeOfLiteralType(getLiteralTypeForText(TypeFlags.StringLiteral, (<LiteralExpression>node).text));
|
||||
case SyntaxKind.NumericLiteral:
|
||||
return getLiteralTypeForText(TypeFlags.NumberLiteral, (<LiteralExpression>node).text);
|
||||
return getFreshTypeOfLiteralType(getLiteralTypeForText(TypeFlags.NumberLiteral, (<LiteralExpression>node).text));
|
||||
case SyntaxKind.TrueKeyword:
|
||||
return trueType;
|
||||
case SyntaxKind.FalseKeyword:
|
||||
return node.kind === SyntaxKind.TrueKeyword ? trueType : falseType;
|
||||
return falseType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13754,7 +13839,7 @@ namespace ts {
|
||||
const type = checkExpressionCached(declaration.initializer);
|
||||
return getCombinedNodeFlags(declaration) & NodeFlags.Const ||
|
||||
getCombinedModifierFlags(declaration) & ModifierFlags.Readonly ||
|
||||
isTypeAssertion(declaration.initializer) ? type : getBaseTypeOfLiteralType(type);
|
||||
isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type);
|
||||
}
|
||||
|
||||
function isLiteralContextualType(contextualType: Type) {
|
||||
@@ -13776,7 +13861,7 @@ namespace ts {
|
||||
|
||||
function checkExpressionForMutableLocation(node: Expression, contextualMapper?: TypeMapper): Type {
|
||||
const type = checkExpression(node, contextualMapper);
|
||||
return isTypeAssertion(node) || isLiteralContextualType(getContextualType(node)) ? type : getBaseTypeOfLiteralType(type);
|
||||
return isTypeAssertion(node) || isLiteralContextualType(getContextualType(node)) ? type : getWidenedLiteralType(type);
|
||||
}
|
||||
|
||||
function checkPropertyAssignment(node: PropertyAssignment, contextualMapper?: TypeMapper): Type {
|
||||
@@ -15630,6 +15715,11 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkCollisionWithRequireExportsInGeneratedCode(node: Node, name: Identifier) {
|
||||
// No need to check for require or exports for ES6 modules and later
|
||||
if (modulekind >= ModuleKind.ES6) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
||||
return;
|
||||
}
|
||||
@@ -18468,7 +18558,7 @@ namespace ts {
|
||||
// for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) {
|
||||
if (expr.parent.kind === SyntaxKind.PropertyAssignment) {
|
||||
const typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(<Expression>expr.parent.parent);
|
||||
return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, <ObjectLiteralElement>expr.parent);
|
||||
return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, <ObjectLiteralElementLike>expr.parent);
|
||||
}
|
||||
// Array literal assignment - array destructuring pattern
|
||||
Debug.assert(expr.parent.kind === SyntaxKind.ArrayLiteralExpression);
|
||||
@@ -18495,7 +18585,7 @@ namespace ts {
|
||||
if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) {
|
||||
expr = <Expression>expr.parent;
|
||||
}
|
||||
return checkExpression(expr);
|
||||
return getRegularTypeOfLiteralType(checkExpression(expr));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -18906,7 +18996,7 @@ namespace ts {
|
||||
// Get type of the symbol if this is the valid symbol otherwise get type at location
|
||||
const symbol = getSymbolOfNode(declaration);
|
||||
const type = symbol && !(symbol.flags & (SymbolFlags.TypeLiteral | SymbolFlags.Signature))
|
||||
? getTypeOfSymbol(symbol)
|
||||
? getWidenedLiteralType(getTypeOfSymbol(symbol))
|
||||
: unknownType;
|
||||
|
||||
getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);
|
||||
@@ -18966,6 +19056,19 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function isLiteralConstDeclaration(node: VariableDeclaration): boolean {
|
||||
if (isConst(node)) {
|
||||
const type = getTypeOfSymbol(getSymbolOfNode(node));
|
||||
return !!(type.flags & TypeFlags.StringOrNumberLiteral && type.flags & TypeFlags.FreshLiteral);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function writeLiteralConstValue(node: VariableDeclaration, writer: SymbolWriter) {
|
||||
const type = getTypeOfSymbol(getSymbolOfNode(node));
|
||||
writer.writeStringLiteral(literalTypeToString(<LiteralType>type));
|
||||
}
|
||||
|
||||
function createResolver(): EmitResolver {
|
||||
// this variable and functions that use it are deliberately moved here from the outer scope
|
||||
// to avoid scope pollution
|
||||
@@ -19010,7 +19113,9 @@ namespace ts {
|
||||
isArgumentsLocalBinding,
|
||||
getExternalModuleFileFromDeclaration,
|
||||
getTypeReferenceDirectivesForEntityName,
|
||||
getTypeReferenceDirectivesForSymbol
|
||||
getTypeReferenceDirectivesForSymbol,
|
||||
isLiteralConstDeclaration,
|
||||
writeLiteralConstValue
|
||||
};
|
||||
|
||||
// defined here to avoid outer scope pollution
|
||||
@@ -20156,10 +20261,29 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function isStringOrNumberLiteralExpression(expr: Expression) {
|
||||
return expr.kind === SyntaxKind.StringLiteral || expr.kind === SyntaxKind.NumericLiteral ||
|
||||
expr.kind === SyntaxKind.PrefixUnaryExpression && (<PrefixUnaryExpression>expr).operator === SyntaxKind.MinusToken &&
|
||||
(<PrefixUnaryExpression>expr).operand.kind === SyntaxKind.NumericLiteral;
|
||||
}
|
||||
|
||||
function checkGrammarVariableDeclaration(node: VariableDeclaration) {
|
||||
if (node.parent.parent.kind !== SyntaxKind.ForInStatement && node.parent.parent.kind !== SyntaxKind.ForOfStatement) {
|
||||
if (isInAmbientContext(node)) {
|
||||
if (node.initializer) {
|
||||
if (isConst(node) && !node.type) {
|
||||
if (!isStringOrNumberLiteralExpression(node.initializer)) {
|
||||
return grammarErrorOnNode(node.initializer, Diagnostics.A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Error on equals token which immediate precedes the initializer
|
||||
const equalsTokenLength = "=".length;
|
||||
return grammarErrorAtPos(getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength,
|
||||
equalsTokenLength, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
|
||||
}
|
||||
}
|
||||
if (node.initializer && !(isConst(node) && isStringOrNumberLiteralExpression(node.initializer))) {
|
||||
// Error on equals token which immediate precedes the initializer
|
||||
const equalsTokenLength = "=".length;
|
||||
return grammarErrorAtPos(getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength,
|
||||
|
||||
@@ -408,6 +408,7 @@ namespace ts {
|
||||
"es2017": "lib.es2017.d.ts",
|
||||
// Host only
|
||||
"dom": "lib.dom.d.ts",
|
||||
"dom.iterable": "lib.dom.iterable.d.ts",
|
||||
"webworker": "lib.webworker.d.ts",
|
||||
"scripthost": "lib.scripthost.d.ts",
|
||||
// ES2015 Or ESNext By-feature options
|
||||
|
||||
@@ -1142,6 +1142,10 @@ namespace ts {
|
||||
if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) && node.parent.kind === SyntaxKind.TypeLiteral) {
|
||||
emitTypeOfVariableDeclarationFromTypeLiteral(node);
|
||||
}
|
||||
else if (resolver.isLiteralConstDeclaration(node)) {
|
||||
write(" = ");
|
||||
resolver.writeLiteralConstValue(node, writer);
|
||||
}
|
||||
else if (!hasModifier(node, ModifierFlags.Private)) {
|
||||
writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError);
|
||||
}
|
||||
|
||||
@@ -819,6 +819,10 @@
|
||||
"category": "Error",
|
||||
"code": 1253
|
||||
},
|
||||
"A 'const' initializer in an ambient context must be a string or numeric literal.": {
|
||||
"category": "Error",
|
||||
"code": 1254
|
||||
},
|
||||
"'with' statements are not allowed in an async function block.": {
|
||||
"category": "Error",
|
||||
"code": 1300
|
||||
@@ -1959,6 +1963,10 @@
|
||||
"category": "Error",
|
||||
"code": 2695
|
||||
},
|
||||
"The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?": {
|
||||
"category": "Error",
|
||||
"code": 2696
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
|
||||
@@ -416,7 +416,7 @@ namespace ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
export function createObjectLiteral(properties?: ObjectLiteralElement[], location?: TextRange, multiLine?: boolean) {
|
||||
export function createObjectLiteral(properties?: ObjectLiteralElementLike[], location?: TextRange, multiLine?: boolean) {
|
||||
const node = <ObjectLiteralExpression>createNode(SyntaxKind.ObjectLiteralExpression, location);
|
||||
node.properties = createNodeArray(properties);
|
||||
if (multiLine) {
|
||||
@@ -425,7 +425,7 @@ namespace ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
export function updateObjectLiteral(node: ObjectLiteralExpression, properties: ObjectLiteralElement[]) {
|
||||
export function updateObjectLiteral(node: ObjectLiteralExpression, properties: ObjectLiteralElementLike[]) {
|
||||
if (node.properties !== properties) {
|
||||
return updateNode(createObjectLiteral(properties, node, node.multiLine), node);
|
||||
}
|
||||
@@ -2069,7 +2069,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function createExpressionForObjectLiteralElement(node: ObjectLiteralExpression, property: ObjectLiteralElement, receiver: Expression): Expression {
|
||||
export function createExpressionForObjectLiteralElementLike(node: ObjectLiteralExpression, property: ObjectLiteralElementLike, receiver: Expression): Expression {
|
||||
switch (property.kind) {
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -2086,7 +2086,7 @@ namespace ts {
|
||||
function createExpressionForAccessorDeclaration(properties: NodeArray<Declaration>, property: AccessorDeclaration, receiver: Expression, multiLine: boolean) {
|
||||
const { firstAccessor, getAccessor, setAccessor } = getAllAccessorDeclarations(properties, property);
|
||||
if (property === firstAccessor) {
|
||||
const properties: ObjectLiteralElement[] = [];
|
||||
const properties: ObjectLiteralElementLike[] = [];
|
||||
if (getAccessor) {
|
||||
const getterFunction = createFunctionExpression(
|
||||
/*asteriskToken*/ undefined,
|
||||
|
||||
@@ -4121,7 +4121,7 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function parseObjectLiteralElement(): ObjectLiteralElement {
|
||||
function parseObjectLiteralElement(): ObjectLiteralElementLike {
|
||||
const fullStart = scanner.getStartPos();
|
||||
const decorators = parseDecorators();
|
||||
const modifiers = parseModifiers();
|
||||
|
||||
@@ -126,14 +126,22 @@ namespace ts {
|
||||
context: TransformationContext,
|
||||
node: VariableDeclaration,
|
||||
value?: Expression,
|
||||
visitor?: (node: Node) => VisitResult<Node>) {
|
||||
visitor?: (node: Node) => VisitResult<Node>,
|
||||
recordTempVariable?: (node: Identifier) => void) {
|
||||
const declarations: VariableDeclaration[] = [];
|
||||
|
||||
let pendingAssignments: Expression[];
|
||||
flattenDestructuring(context, node, value, node, emitAssignment, emitTempVariableAssignment, visitor);
|
||||
|
||||
return declarations;
|
||||
|
||||
function emitAssignment(name: Identifier, value: Expression, location: TextRange, original: Node) {
|
||||
if (pendingAssignments) {
|
||||
pendingAssignments.push(value);
|
||||
value = inlineExpressions(pendingAssignments);
|
||||
pendingAssignments = undefined;
|
||||
}
|
||||
|
||||
const declaration = createVariableDeclaration(name, /*type*/ undefined, value, location);
|
||||
declaration.original = original;
|
||||
|
||||
@@ -146,8 +154,19 @@ namespace ts {
|
||||
}
|
||||
|
||||
function emitTempVariableAssignment(value: Expression, location: TextRange) {
|
||||
const name = createTempVariable(/*recordTempVariable*/ undefined);
|
||||
emitAssignment(name, value, location, /*original*/ undefined);
|
||||
const name = createTempVariable(recordTempVariable);
|
||||
if (recordTempVariable) {
|
||||
const assignment = createAssignment(name, value, location);
|
||||
if (pendingAssignments) {
|
||||
pendingAssignments.push(assignment);
|
||||
}
|
||||
else {
|
||||
pendingAssignments = [assignment];
|
||||
}
|
||||
}
|
||||
else {
|
||||
emitAssignment(name, value, location, /*original*/ undefined);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,12 +163,12 @@ namespace ts {
|
||||
let currentText: string;
|
||||
let currentParent: Node;
|
||||
let currentNode: Node;
|
||||
let enclosingVariableStatement: VariableStatement;
|
||||
let enclosingBlockScopeContainer: Node;
|
||||
let enclosingBlockScopeContainerParent: Node;
|
||||
let containingNonArrowFunction: FunctionLikeDeclaration | ClassElement;
|
||||
|
||||
/** Tracks the container that determines whether `super.x` is a static. */
|
||||
let superScopeContainer: FunctionLikeDeclaration | ClassElement;
|
||||
let enclosingFunction: FunctionLikeDeclaration;
|
||||
let enclosingNonArrowFunction: FunctionLikeDeclaration;
|
||||
let enclosingNonAsyncFunctionBody: FunctionLikeDeclaration | ClassElement;
|
||||
|
||||
/**
|
||||
* Used to track if we are emitting body of the converted loop
|
||||
@@ -182,11 +182,6 @@ namespace ts {
|
||||
*/
|
||||
let enabledSubstitutions: ES6SubstitutionFlags;
|
||||
|
||||
/**
|
||||
* This is used to determine whether we need to emit `_this` instead of `this`.
|
||||
*/
|
||||
let useCapturedThis: boolean;
|
||||
|
||||
return transformSourceFile;
|
||||
|
||||
function transformSourceFile(node: SourceFile) {
|
||||
@@ -206,13 +201,14 @@ namespace ts {
|
||||
}
|
||||
|
||||
function saveStateAndInvoke<T>(node: Node, f: (node: Node) => T): T {
|
||||
const savedContainingNonArrowFunction = containingNonArrowFunction;
|
||||
const savedSuperScopeContainer = superScopeContainer;
|
||||
const savedCurrentParent = currentParent;
|
||||
const savedCurrentNode = currentNode;
|
||||
const savedEnclosingFunction = enclosingFunction;
|
||||
const savedEnclosingNonArrowFunction = enclosingNonArrowFunction;
|
||||
const savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody;
|
||||
const savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer;
|
||||
const savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent;
|
||||
|
||||
const savedEnclosingVariableStatement = enclosingVariableStatement;
|
||||
const savedCurrentParent = currentParent;
|
||||
const savedCurrentNode = currentNode;
|
||||
const savedConvertedLoopState = convertedLoopState;
|
||||
if (nodeStartsNewLexicalEnvironment(node)) {
|
||||
// don't treat content of nodes that start new lexical environment as part of converted loop copy
|
||||
@@ -223,12 +219,14 @@ namespace ts {
|
||||
const visited = f(node);
|
||||
|
||||
convertedLoopState = savedConvertedLoopState;
|
||||
containingNonArrowFunction = savedContainingNonArrowFunction;
|
||||
superScopeContainer = savedSuperScopeContainer;
|
||||
currentParent = savedCurrentParent;
|
||||
currentNode = savedCurrentNode;
|
||||
enclosingFunction = savedEnclosingFunction;
|
||||
enclosingNonArrowFunction = savedEnclosingNonArrowFunction;
|
||||
enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody;
|
||||
enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer;
|
||||
enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent;
|
||||
enclosingVariableStatement = savedEnclosingVariableStatement;
|
||||
currentParent = savedCurrentParent;
|
||||
currentNode = savedCurrentNode;
|
||||
return visited;
|
||||
}
|
||||
|
||||
@@ -251,22 +249,13 @@ namespace ts {
|
||||
}
|
||||
|
||||
function visitorForConvertedLoopWorker(node: Node): VisitResult<Node> {
|
||||
const savedUseCapturedThis = useCapturedThis;
|
||||
|
||||
if (nodeStartsNewLexicalEnvironment(node)) {
|
||||
useCapturedThis = false;
|
||||
}
|
||||
|
||||
let result: VisitResult<Node>;
|
||||
|
||||
if (shouldCheckNode(node)) {
|
||||
result = visitJavaScript(node);
|
||||
}
|
||||
else {
|
||||
result = visitNodesInConvertedLoop(node);
|
||||
}
|
||||
|
||||
useCapturedThis = savedUseCapturedThis;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -320,7 +309,7 @@ namespace ts {
|
||||
return visitFunctionExpression(<FunctionExpression>node);
|
||||
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
return visitVariableDeclaration(<VariableDeclaration>node, /*offset*/ undefined);
|
||||
return visitVariableDeclaration(<VariableDeclaration>node);
|
||||
|
||||
case SyntaxKind.Identifier:
|
||||
return visitIdentifier(<Identifier>node);
|
||||
@@ -409,30 +398,44 @@ namespace ts {
|
||||
}
|
||||
|
||||
function onBeforeVisitNode(node: Node) {
|
||||
const currentGrandparent = currentParent;
|
||||
currentParent = currentNode;
|
||||
currentNode = node;
|
||||
|
||||
if (currentParent) {
|
||||
if (isBlockScope(currentParent, currentGrandparent)) {
|
||||
enclosingBlockScopeContainer = currentParent;
|
||||
enclosingBlockScopeContainerParent = currentGrandparent;
|
||||
if (currentNode) {
|
||||
if (isBlockScope(currentNode, currentParent)) {
|
||||
enclosingBlockScopeContainer = currentNode;
|
||||
enclosingBlockScopeContainerParent = currentParent;
|
||||
}
|
||||
|
||||
switch (currentParent.kind) {
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
containingNonArrowFunction = <FunctionLikeDeclaration>currentParent;
|
||||
if (!(containingNonArrowFunction.emitFlags & NodeEmitFlags.AsyncFunctionBody)) {
|
||||
superScopeContainer = containingNonArrowFunction;
|
||||
if (isFunctionLike(currentNode)) {
|
||||
enclosingFunction = currentNode;
|
||||
if (currentNode.kind !== SyntaxKind.ArrowFunction) {
|
||||
enclosingNonArrowFunction = currentNode;
|
||||
if (!(currentNode.emitFlags & NodeEmitFlags.AsyncFunctionBody)) {
|
||||
enclosingNonAsyncFunctionBody = currentNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// keep track of the enclosing variable statement when in the context of
|
||||
// variable statements, variable declarations, binding elements, and binding
|
||||
// patterns.
|
||||
switch (currentNode.kind) {
|
||||
case SyntaxKind.VariableStatement:
|
||||
enclosingVariableStatement = <VariableStatement>currentNode;
|
||||
break;
|
||||
|
||||
case SyntaxKind.VariableDeclarationList:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
case SyntaxKind.ObjectBindingPattern:
|
||||
case SyntaxKind.ArrayBindingPattern:
|
||||
break;
|
||||
|
||||
default:
|
||||
enclosingVariableStatement = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
currentParent = currentNode;
|
||||
currentNode = node;
|
||||
}
|
||||
|
||||
function visitSwitchStatement(node: SwitchStatement): SwitchStatement {
|
||||
@@ -468,9 +471,8 @@ namespace ts {
|
||||
|
||||
function visitThisKeyword(node: Node): Node {
|
||||
Debug.assert(convertedLoopState !== undefined);
|
||||
|
||||
if (useCapturedThis) {
|
||||
// if useCapturedThis is true then 'this' keyword is contained inside an arrow function.
|
||||
if (enclosingFunction && enclosingFunction.kind === SyntaxKind.ArrowFunction) {
|
||||
// if the enclosing function is an ArrowFunction is then we use the captured 'this' keyword.
|
||||
convertedLoopState.containsLexicalThis = true;
|
||||
return node;
|
||||
}
|
||||
@@ -1259,7 +1261,7 @@ namespace ts {
|
||||
setNodeEmitFlags(propertyName, NodeEmitFlags.NoComments | NodeEmitFlags.NoLeadingSourceMap);
|
||||
setSourceMapRange(propertyName, firstAccessor.name);
|
||||
|
||||
const properties: ObjectLiteralElement[] = [];
|
||||
const properties: ObjectLiteralElementLike[] = [];
|
||||
if (getAccessor) {
|
||||
const getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined);
|
||||
setSourceMapRange(getterFunction, getSourceMapRange(getAccessor));
|
||||
@@ -1306,12 +1308,7 @@ namespace ts {
|
||||
enableSubstitutionsForCapturedThis();
|
||||
}
|
||||
|
||||
const savedUseCapturedThis = useCapturedThis;
|
||||
useCapturedThis = true;
|
||||
|
||||
const func = transformFunctionLikeToExpression(node, /*location*/ node, /*name*/ undefined);
|
||||
|
||||
useCapturedThis = savedUseCapturedThis;
|
||||
setNodeEmitFlags(func, NodeEmitFlags.CapturesThis);
|
||||
return func;
|
||||
}
|
||||
@@ -1334,7 +1331,7 @@ namespace ts {
|
||||
return setOriginalNode(
|
||||
createFunctionDeclaration(
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ undefined,
|
||||
node.modifiers,
|
||||
node.asteriskToken,
|
||||
node.name,
|
||||
/*typeParameters*/ undefined,
|
||||
@@ -1354,9 +1351,9 @@ namespace ts {
|
||||
* @param name The name of the new FunctionExpression.
|
||||
*/
|
||||
function transformFunctionLikeToExpression(node: FunctionLikeDeclaration, location: TextRange, name: Identifier): FunctionExpression {
|
||||
const savedContainingNonArrowFunction = containingNonArrowFunction;
|
||||
const savedContainingNonArrowFunction = enclosingNonArrowFunction;
|
||||
if (node.kind !== SyntaxKind.ArrowFunction) {
|
||||
containingNonArrowFunction = node;
|
||||
enclosingNonArrowFunction = node;
|
||||
}
|
||||
|
||||
const expression = setOriginalNode(
|
||||
@@ -1372,7 +1369,7 @@ namespace ts {
|
||||
/*original*/ node
|
||||
);
|
||||
|
||||
containingNonArrowFunction = savedContainingNonArrowFunction;
|
||||
enclosingNonArrowFunction = savedContainingNonArrowFunction;
|
||||
return expression;
|
||||
}
|
||||
|
||||
@@ -1663,13 +1660,13 @@ namespace ts {
|
||||
*
|
||||
* @param node A VariableDeclaration node.
|
||||
*/
|
||||
function visitVariableDeclarationInLetDeclarationList(node: VariableDeclaration, offset: number) {
|
||||
function visitVariableDeclarationInLetDeclarationList(node: VariableDeclaration) {
|
||||
// For binding pattern names that lack initializers there is no point to emit
|
||||
// explicit initializer since downlevel codegen for destructuring will fail
|
||||
// in the absence of initializer so all binding elements will say uninitialized
|
||||
const name = node.name;
|
||||
if (isBindingPattern(name)) {
|
||||
return visitVariableDeclaration(node, offset);
|
||||
return visitVariableDeclaration(node);
|
||||
}
|
||||
|
||||
if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) {
|
||||
@@ -1686,10 +1683,13 @@ namespace ts {
|
||||
*
|
||||
* @param node A VariableDeclaration node.
|
||||
*/
|
||||
function visitVariableDeclaration(node: VariableDeclaration, offset: number): VisitResult<VariableDeclaration> {
|
||||
function visitVariableDeclaration(node: VariableDeclaration): VisitResult<VariableDeclaration> {
|
||||
// If we are here it is because the name contains a binding pattern.
|
||||
if (isBindingPattern(node.name)) {
|
||||
return flattenVariableDestructuring(context, node, /*value*/ undefined, visitor);
|
||||
const recordTempVariablesInLine = !enclosingVariableStatement
|
||||
|| !hasModifier(enclosingVariableStatement, ModifierFlags.Export);
|
||||
return flattenVariableDestructuring(context, node, /*value*/ undefined, visitor,
|
||||
recordTempVariablesInLine ? undefined : hoistVariableDeclaration);
|
||||
}
|
||||
|
||||
return visitEachChild(node, visitor, context);
|
||||
@@ -1765,7 +1765,7 @@ namespace ts {
|
||||
// Note also that because an extra statement is needed to assign to the LHS,
|
||||
// for-of bodies are always emitted as blocks.
|
||||
|
||||
const expression = node.expression;
|
||||
const expression = visitNode(node.expression, visitor, isExpression);
|
||||
const initializer = node.initializer;
|
||||
const statements: Statement[] = [];
|
||||
|
||||
@@ -1940,7 +1940,7 @@ namespace ts {
|
||||
temp,
|
||||
setNodeEmitFlags(
|
||||
createObjectLiteral(
|
||||
visitNodes(properties, visitor, isObjectLiteralElement, 0, numInitialProperties),
|
||||
visitNodes(properties, visitor, isObjectLiteralElementLike, 0, numInitialProperties),
|
||||
/*location*/ undefined,
|
||||
node.multiLine
|
||||
),
|
||||
@@ -2014,7 +2014,7 @@ namespace ts {
|
||||
case SyntaxKind.ForOfStatement:
|
||||
const initializer = (<ForStatement | ForInStatement | ForOfStatement>node).initializer;
|
||||
if (initializer && initializer.kind === SyntaxKind.VariableDeclarationList) {
|
||||
loopInitializer = <VariableDeclarationList>(<ForStatement | ForInStatement | ForOfStatement>node).initializer;
|
||||
loopInitializer = <VariableDeclarationList>initializer;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2066,8 +2066,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
const isAsyncBlockContainingAwait =
|
||||
containingNonArrowFunction
|
||||
&& (containingNonArrowFunction.emitFlags & NodeEmitFlags.AsyncFunctionBody) !== 0
|
||||
enclosingNonArrowFunction
|
||||
&& (enclosingNonArrowFunction.emitFlags & NodeEmitFlags.AsyncFunctionBody) !== 0
|
||||
&& (node.statement.transformFlags & TransformFlags.ContainsYield) !== 0;
|
||||
|
||||
let loopBodyFlags: NodeEmitFlags = 0;
|
||||
@@ -2474,7 +2474,7 @@ namespace ts {
|
||||
*
|
||||
* @param node A MethodDeclaration node.
|
||||
*/
|
||||
function visitMethodDeclaration(node: MethodDeclaration): ObjectLiteralElement {
|
||||
function visitMethodDeclaration(node: MethodDeclaration): ObjectLiteralElementLike {
|
||||
// We should only get here for methods on an object literal with regular identifier names.
|
||||
// Methods on classes are handled in visitClassDeclaration/visitClassExpression.
|
||||
// Methods with computed property names are handled in visitObjectLiteralExpression.
|
||||
@@ -2493,7 +2493,7 @@ namespace ts {
|
||||
*
|
||||
* @param node A ShorthandPropertyAssignment node.
|
||||
*/
|
||||
function visitShorthandPropertyAssignment(node: ShorthandPropertyAssignment): ObjectLiteralElement {
|
||||
function visitShorthandPropertyAssignment(node: ShorthandPropertyAssignment): ObjectLiteralElementLike {
|
||||
return createPropertyAssignment(
|
||||
node.name,
|
||||
getSynthesizedClone(node.name),
|
||||
@@ -2829,9 +2829,9 @@ namespace ts {
|
||||
* Visits the `super` keyword
|
||||
*/
|
||||
function visitSuperKeyword(node: PrimaryExpression): LeftHandSideExpression {
|
||||
return superScopeContainer
|
||||
&& isClassElement(superScopeContainer)
|
||||
&& !hasModifier(superScopeContainer, ModifierFlags.Static)
|
||||
return enclosingNonAsyncFunctionBody
|
||||
&& isClassElement(enclosingNonAsyncFunctionBody)
|
||||
&& !hasModifier(enclosingNonAsyncFunctionBody, ModifierFlags.Static)
|
||||
&& currentParent.kind !== SyntaxKind.CallExpression
|
||||
? createPropertyAccess(createIdentifier("_super"), "prototype")
|
||||
: createIdentifier("_super");
|
||||
@@ -2856,17 +2856,16 @@ namespace ts {
|
||||
* @param node The node to be printed.
|
||||
*/
|
||||
function onEmitNode(node: Node, emit: (node: Node) => void) {
|
||||
const savedUseCapturedThis = useCapturedThis;
|
||||
const savedEnclosingFunction = enclosingFunction;
|
||||
|
||||
if (enabledSubstitutions & ES6SubstitutionFlags.CapturedThis && isFunctionLike(node)) {
|
||||
// If we are tracking a captured `this`, push a bit that indicates whether the
|
||||
// containing function is an arrow function.
|
||||
useCapturedThis = (getNodeEmitFlags(node) & NodeEmitFlags.CapturesThis) !== 0;
|
||||
// If we are tracking a captured `this`, keep track of the enclosing function.
|
||||
enclosingFunction = node;
|
||||
}
|
||||
|
||||
previousOnEmitNode(node, emit);
|
||||
|
||||
useCapturedThis = savedUseCapturedThis;
|
||||
enclosingFunction = savedEnclosingFunction;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2994,7 +2993,9 @@ namespace ts {
|
||||
* @param node The ThisKeyword node.
|
||||
*/
|
||||
function substituteThisKeyword(node: PrimaryExpression): PrimaryExpression {
|
||||
if (enabledSubstitutions & ES6SubstitutionFlags.CapturedThis && useCapturedThis) {
|
||||
if (enabledSubstitutions & ES6SubstitutionFlags.CapturedThis
|
||||
&& enclosingFunction
|
||||
&& enclosingFunction.emitFlags & NodeEmitFlags.CapturesThis) {
|
||||
return createIdentifier("_this", /*location*/ node);
|
||||
}
|
||||
|
||||
|
||||
@@ -573,11 +573,11 @@ namespace ts {
|
||||
operationLocations = undefined;
|
||||
state = createTempVariable(/*recordTempVariable*/ undefined);
|
||||
|
||||
const statementOffset = addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor);
|
||||
|
||||
// Build the generator
|
||||
startLexicalEnvironment();
|
||||
|
||||
const statementOffset = addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor);
|
||||
|
||||
transformAndEmitStatements(body.statements, statementOffset);
|
||||
|
||||
const buildResult = build();
|
||||
@@ -615,6 +615,11 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
else {
|
||||
// Do not hoist custom prologues.
|
||||
if (node.emitFlags & NodeEmitFlags.CustomPrologue) {
|
||||
return node;
|
||||
}
|
||||
|
||||
for (const variable of node.declarationList.declarations) {
|
||||
hoistVariableDeclaration(<Identifier>variable.name);
|
||||
}
|
||||
@@ -1020,7 +1025,7 @@ namespace ts {
|
||||
const temp = declareLocal();
|
||||
emitAssignment(temp,
|
||||
createObjectLiteral(
|
||||
visitNodes(properties, visitor, isObjectLiteralElement, 0, numInitialProperties),
|
||||
visitNodes(properties, visitor, isObjectLiteralElementLike, 0, numInitialProperties),
|
||||
/*location*/ undefined,
|
||||
multiLine
|
||||
)
|
||||
@@ -1030,13 +1035,13 @@ namespace ts {
|
||||
expressions.push(multiLine ? startOnNewLine(getMutableClone(temp)) : temp);
|
||||
return inlineExpressions(expressions);
|
||||
|
||||
function reduceProperty(expressions: Expression[], property: ObjectLiteralElement) {
|
||||
function reduceProperty(expressions: Expression[], property: ObjectLiteralElementLike) {
|
||||
if (containsYield(property) && expressions.length > 0) {
|
||||
emitStatement(createStatement(inlineExpressions(expressions)));
|
||||
expressions = [];
|
||||
}
|
||||
|
||||
const expression = createExpressionForObjectLiteralElement(node, property, temp);
|
||||
const expression = createExpressionForObjectLiteralElementLike(node, property, temp);
|
||||
const visited = visitNode(expression, visitor, isExpression);
|
||||
if (visited) {
|
||||
if (multiLine) {
|
||||
|
||||
@@ -850,7 +850,7 @@ namespace ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
function substituteShorthandPropertyAssignment(node: ShorthandPropertyAssignment): ObjectLiteralElement {
|
||||
function substituteShorthandPropertyAssignment(node: ShorthandPropertyAssignment): ObjectLiteralElementLike {
|
||||
const name = node.name;
|
||||
const exportedOrImportedName = substituteExpressionIdentifier(name);
|
||||
if (exportedOrImportedName !== name) {
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
const exportedNames: ObjectLiteralElement[] = [];
|
||||
const exportedNames: ObjectLiteralElementLike[] = [];
|
||||
if (exportedLocalNames) {
|
||||
for (const exportedLocalName of exportedLocalNames) {
|
||||
// write name of exported declaration, i.e 'export var x...'
|
||||
@@ -1107,7 +1107,7 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasExportedReferenceInObjectDestructuringElement(node: ObjectLiteralElement): boolean {
|
||||
function hasExportedReferenceInObjectDestructuringElement(node: ObjectLiteralElementLike): boolean {
|
||||
if (isShorthandPropertyAssignment(node)) {
|
||||
return isExportedBinding(node.name);
|
||||
}
|
||||
|
||||
@@ -1560,7 +1560,7 @@ namespace ts {
|
||||
|
||||
function addNewTypeMetadata(node: Declaration, decoratorExpressions: Expression[]) {
|
||||
if (compilerOptions.emitDecoratorMetadata) {
|
||||
let properties: ObjectLiteralElement[];
|
||||
let properties: ObjectLiteralElementLike[];
|
||||
if (shouldAddTypeMetadata(node)) {
|
||||
(properties || (properties = [])).push(createPropertyAssignment("type", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, /*equalsGreaterThanToken*/ undefined, serializeTypeOfNode(node))));
|
||||
}
|
||||
@@ -3273,7 +3273,7 @@ namespace ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
function substituteShorthandPropertyAssignment(node: ShorthandPropertyAssignment): ObjectLiteralElement {
|
||||
function substituteShorthandPropertyAssignment(node: ShorthandPropertyAssignment): ObjectLiteralElementLike {
|
||||
if (enabledSubstitutions & TypeScriptSubstitutionFlags.NamespaceExports) {
|
||||
const name = node.name;
|
||||
const exportedName = trySubstituteNamespaceExportedName(name);
|
||||
|
||||
+15
-13
@@ -667,7 +667,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function printHelp() {
|
||||
let output = "";
|
||||
const output: string[] = [];
|
||||
|
||||
// We want to align our "syntax" and "examples" commands to a certain margin.
|
||||
const syntaxLength = getDiagnosticText(Diagnostics.Syntax_Colon_0, "").length;
|
||||
@@ -678,17 +678,17 @@ namespace ts {
|
||||
let syntax = makePadding(marginLength - syntaxLength);
|
||||
syntax += "tsc [" + getDiagnosticText(Diagnostics.options) + "] [" + getDiagnosticText(Diagnostics.file) + " ...]";
|
||||
|
||||
output += getDiagnosticText(Diagnostics.Syntax_Colon_0, syntax);
|
||||
output += sys.newLine + sys.newLine;
|
||||
output.push(getDiagnosticText(Diagnostics.Syntax_Colon_0, syntax));
|
||||
output.push(sys.newLine + sys.newLine);
|
||||
|
||||
// Build up the list of examples.
|
||||
const padding = makePadding(marginLength);
|
||||
output += getDiagnosticText(Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + "tsc hello.ts") + sys.newLine;
|
||||
output += padding + "tsc --outFile file.js file.ts" + sys.newLine;
|
||||
output += padding + "tsc @args.txt" + sys.newLine;
|
||||
output += sys.newLine;
|
||||
output.push(getDiagnosticText(Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + "tsc hello.ts") + sys.newLine);
|
||||
output.push(padding + "tsc --outFile file.js file.ts" + sys.newLine);
|
||||
output.push(padding + "tsc @args.txt" + sys.newLine);
|
||||
output.push(sys.newLine);
|
||||
|
||||
output += getDiagnosticText(Diagnostics.Options_Colon) + sys.newLine;
|
||||
output.push(getDiagnosticText(Diagnostics.Options_Colon) + sys.newLine);
|
||||
|
||||
// Sort our options by their names, (e.g. "--noImplicitAny" comes before "--watch")
|
||||
const optsList = filter(optionDeclarations.slice(), v => !v.experimental);
|
||||
@@ -755,18 +755,20 @@ namespace ts {
|
||||
const usage = usageColumn[i];
|
||||
const description = descriptionColumn[i];
|
||||
const kindsList = optionsDescriptionMap[description];
|
||||
output += usage + makePadding(marginLength - usage.length + 2) + description + sys.newLine;
|
||||
output.push(usage + makePadding(marginLength - usage.length + 2) + description + sys.newLine);
|
||||
|
||||
if (kindsList) {
|
||||
output += makePadding(marginLength + 4);
|
||||
output.push(makePadding(marginLength + 4));
|
||||
for (const kind of kindsList) {
|
||||
output += kind + " ";
|
||||
output.push(kind + " ");
|
||||
}
|
||||
output += sys.newLine;
|
||||
output.push(sys.newLine);
|
||||
}
|
||||
}
|
||||
|
||||
sys.write(output);
|
||||
for (const line of output) {
|
||||
sys.write(line);
|
||||
}
|
||||
return;
|
||||
|
||||
function getParamType(option: CommandLineOption) {
|
||||
|
||||
+26
-8
@@ -648,6 +648,8 @@ namespace ts {
|
||||
name?: PropertyName;
|
||||
}
|
||||
|
||||
export type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | MethodDeclaration | AccessorDeclaration;
|
||||
|
||||
// @kind(SyntaxKind.PropertyAssignment)
|
||||
export interface PropertyAssignment extends ObjectLiteralElement {
|
||||
_propertyAssignmentBrand: any;
|
||||
@@ -1048,10 +1050,19 @@ namespace ts {
|
||||
expression: Expression;
|
||||
}
|
||||
|
||||
/**
|
||||
* This interface is a base interface for ObjectLiteralExpression and JSXAttributes to extend from. JSXAttributes is similar to
|
||||
* ObjectLiteralExpression in that it contains array of properties; however, JSXAttributes' properties can only be
|
||||
* JSXAttribute or JSXSpreadAttribute. ObjectLiteralExpression, on the other hand, can only have properties of type
|
||||
* ObjectLiteralElement (e.g. PropertyAssignment, ShorthandPropertyAssignment etc.)
|
||||
**/
|
||||
export interface ObjectLiteralExpressionBase<T extends ObjectLiteralElement> extends PrimaryExpression, Declaration {
|
||||
properties: NodeArray<T>;
|
||||
}
|
||||
|
||||
// An ObjectLiteralExpression is the declaration node for an anonymous symbol.
|
||||
// @kind(SyntaxKind.ObjectLiteralExpression)
|
||||
export interface ObjectLiteralExpression extends PrimaryExpression, Declaration {
|
||||
properties: NodeArray<ObjectLiteralElement>;
|
||||
export interface ObjectLiteralExpression extends ObjectLiteralExpressionBase<ObjectLiteralElementLike> {
|
||||
/* @internal */
|
||||
multiLine?: boolean;
|
||||
}
|
||||
@@ -1604,7 +1615,7 @@ namespace ts {
|
||||
|
||||
// @kind(SyntaxKind.JSDocComment)
|
||||
export interface JSDoc extends Node {
|
||||
tags: NodeArray<JSDocTag>;
|
||||
tags: NodeArray<JSDocTag> | undefined;
|
||||
comment: string | undefined;
|
||||
}
|
||||
|
||||
@@ -2156,6 +2167,8 @@ namespace ts {
|
||||
getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration): SourceFile;
|
||||
getTypeReferenceDirectivesForEntityName(name: EntityNameOrEntityNameExpression): string[];
|
||||
getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): string[];
|
||||
isLiteralConstDeclaration(node: VariableDeclaration): boolean;
|
||||
writeLiteralConstValue(node: VariableDeclaration, writer: SymbolWriter): void;
|
||||
}
|
||||
|
||||
export const enum SymbolFlags {
|
||||
@@ -2276,7 +2289,8 @@ namespace ts {
|
||||
mapper?: TypeMapper; // Type mapper for instantiation alias
|
||||
referenced?: boolean; // True if alias symbol has been referenced as a value
|
||||
containingType?: UnionOrIntersectionType; // Containing union or intersection type for synthetic property
|
||||
hasCommonType?: boolean; // True if constituents of synthetic property all have same type
|
||||
hasNonUniformType?: boolean; // True if constituents have non-uniform types
|
||||
isPartial?: boolean; // True if syntheric property of union type occurs in some but not all constituents
|
||||
isDiscriminantProperty?: boolean; // True if discriminant synthetic property
|
||||
resolvedExports?: SymbolTable; // Resolved exports of module
|
||||
exportsChecked?: boolean; // True if exports of external module have been checked
|
||||
@@ -2372,7 +2386,7 @@ namespace ts {
|
||||
/* @internal */
|
||||
ObjectLiteral = 1 << 23, // Originates in an object literal
|
||||
/* @internal */
|
||||
FreshObjectLiteral = 1 << 24, // Fresh object literal type
|
||||
FreshLiteral = 1 << 24, // Fresh literal type
|
||||
/* @internal */
|
||||
ContainsWideningType = 1 << 25, // Type is or contains undefined or null widening type
|
||||
/* @internal */
|
||||
@@ -2385,6 +2399,7 @@ namespace ts {
|
||||
/* @internal */
|
||||
Nullable = Undefined | Null,
|
||||
Literal = StringLiteral | NumberLiteral | BooleanLiteral | EnumLiteral,
|
||||
StringOrNumberLiteral = StringLiteral | NumberLiteral,
|
||||
/* @internal */
|
||||
DefinitelyFalsy = StringLiteral | NumberLiteral | BooleanLiteral | Void | Undefined | Null,
|
||||
PossiblyFalsy = DefinitelyFalsy | String | Number | Boolean,
|
||||
@@ -2426,12 +2441,15 @@ namespace ts {
|
||||
/* @internal */
|
||||
// Intrinsic types (TypeFlags.Intrinsic)
|
||||
export interface IntrinsicType extends Type {
|
||||
intrinsicName: string; // Name of intrinsic type
|
||||
intrinsicName: string; // Name of intrinsic type
|
||||
}
|
||||
|
||||
// String literal types (TypeFlags.StringLiteral)
|
||||
// Numeric literal types (TypeFlags.NumberLiteral)
|
||||
export interface LiteralType extends Type {
|
||||
text: string; // Text of string literal
|
||||
text: string; // Text of literal
|
||||
freshType?: LiteralType; // Fresh version of type
|
||||
regularType?: LiteralType; // Regular version of type
|
||||
}
|
||||
|
||||
// Enum types (TypeFlags.Enum)
|
||||
@@ -2441,7 +2459,7 @@ namespace ts {
|
||||
|
||||
// Enum types (TypeFlags.EnumLiteral)
|
||||
export interface EnumLiteralType extends LiteralType {
|
||||
baseType: EnumType & UnionType;
|
||||
baseType: EnumType & UnionType; // Base enum type
|
||||
}
|
||||
|
||||
// Object types (TypeFlags.ObjectType)
|
||||
|
||||
@@ -3736,7 +3736,7 @@ namespace ts {
|
||||
|| kind === SyntaxKind.SemicolonClassElement;
|
||||
}
|
||||
|
||||
export function isObjectLiteralElement(node: Node): node is ObjectLiteralElement {
|
||||
export function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike {
|
||||
const kind = node.kind;
|
||||
return kind === SyntaxKind.PropertyAssignment
|
||||
|| kind === SyntaxKind.ShorthandPropertyAssignment
|
||||
|
||||
@@ -772,7 +772,7 @@ namespace ts {
|
||||
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return updateObjectLiteral(<ObjectLiteralExpression>node,
|
||||
visitNodes((<ObjectLiteralExpression>node).properties, visitor, isObjectLiteralElement));
|
||||
visitNodes((<ObjectLiteralExpression>node).properties, visitor, isObjectLiteralElementLike));
|
||||
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
return updatePropertyAccess(<PropertyAccessExpression>node,
|
||||
|
||||
@@ -136,9 +136,7 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
|
||||
// check errors
|
||||
it("Correct errors for " + fileName, () => {
|
||||
if (this.errors) {
|
||||
Harness.Compiler.doErrorBaseline(justName, toBeCompiled.concat(otherFiles), result.errors);
|
||||
}
|
||||
Harness.Compiler.doErrorBaseline(justName, toBeCompiled.concat(otherFiles), result.errors);
|
||||
});
|
||||
|
||||
it (`Correct module resolution tracing for ${fileName}`, () => {
|
||||
|
||||
@@ -1407,7 +1407,7 @@ namespace Harness {
|
||||
|
||||
export function doErrorBaseline(baselinePath: string, inputFiles: TestFile[], errors: ts.Diagnostic[]) {
|
||||
Harness.Baseline.runBaseline(baselinePath.replace(/\.tsx?$/, ".errors.txt"), (): string => {
|
||||
if (errors.length === 0) {
|
||||
if (!errors || (errors.length === 0)) {
|
||||
/* tslint:disable:no-null-keyword */
|
||||
return null;
|
||||
/* tslint:enable:no-null-keyword */
|
||||
|
||||
@@ -492,6 +492,9 @@ namespace Harness.LanguageService {
|
||||
getNonBoundSourceFile(fileName: string): ts.SourceFile {
|
||||
throw new Error("SourceFile can not be marshaled across the shim layer.");
|
||||
}
|
||||
getSourceFile(fileName: string): ts.SourceFile {
|
||||
throw new Error("SourceFile can not be marshaled across the shim layer.");
|
||||
}
|
||||
dispose(): void { this.shim.dispose({}); }
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace ts {
|
||||
assertParseResult(["--lib", "es5,invalidOption", "0.ts"],
|
||||
{
|
||||
errors: [{
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory'",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory'",
|
||||
category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
|
||||
@@ -263,7 +263,7 @@ namespace ts {
|
||||
assertParseResult(["--lib", "es5,", "es7", "0.ts"],
|
||||
{
|
||||
errors: [{
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory'",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory'",
|
||||
category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
|
||||
@@ -283,7 +283,7 @@ namespace ts {
|
||||
assertParseResult(["--lib", "es5, ", "es7", "0.ts"],
|
||||
{
|
||||
errors: [{
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory'",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory'",
|
||||
category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace ts {
|
||||
file: undefined,
|
||||
start: 0,
|
||||
length: 0,
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory'",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory'",
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
|
||||
}]
|
||||
@@ -264,7 +264,7 @@ namespace ts {
|
||||
file: undefined,
|
||||
start: 0,
|
||||
length: 0,
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory'",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory'",
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
|
||||
}]
|
||||
@@ -295,7 +295,7 @@ namespace ts {
|
||||
file: undefined,
|
||||
start: 0,
|
||||
length: 0,
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory'",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory'",
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
|
||||
}]
|
||||
@@ -326,7 +326,7 @@ namespace ts {
|
||||
file: undefined,
|
||||
start: 0,
|
||||
length: 0,
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory'",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory'",
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
|
||||
}]
|
||||
|
||||
Vendored
+191
-190
@@ -7536,11 +7536,12 @@ declare var HashChangeEvent: {
|
||||
interface History {
|
||||
readonly length: number;
|
||||
readonly state: any;
|
||||
back(distance?: any): void;
|
||||
forward(distance?: any): void;
|
||||
go(delta?: any): void;
|
||||
pushState(statedata: any, title?: string, url?: string): void;
|
||||
replaceState(statedata: any, title?: string, url?: string): void;
|
||||
scrollRestoration: ScrollRestoration;
|
||||
back(): void;
|
||||
forward(): void;
|
||||
go(delta?: number): void;
|
||||
pushState(data: any, title: string, url?: string | null): void;
|
||||
replaceState(data: any, title: string, url?: string | null): void;
|
||||
}
|
||||
|
||||
declare var History: {
|
||||
@@ -13112,7 +13113,6 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
[index: number]: Window;
|
||||
}
|
||||
|
||||
declare var Window: {
|
||||
@@ -13143,7 +13143,7 @@ declare var XMLDocument: {
|
||||
}
|
||||
|
||||
interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
onreadystatechange: (this: this, ev: ProgressEvent) => any;
|
||||
onreadystatechange: (this: this, ev: Event) => any;
|
||||
readonly readyState: number;
|
||||
readonly response: any;
|
||||
readonly responseText: string;
|
||||
@@ -13170,13 +13170,13 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
readonly LOADING: number;
|
||||
readonly OPENED: number;
|
||||
readonly UNSENT: number;
|
||||
addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "abort", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "load", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadstart", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "readystatechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
@@ -13517,183 +13517,183 @@ interface NavigatorUserMedia {
|
||||
}
|
||||
|
||||
interface NodeSelector {
|
||||
querySelector(selectors: "a"): HTMLAnchorElement;
|
||||
querySelector(selectors: "abbr"): HTMLElement;
|
||||
querySelector(selectors: "acronym"): HTMLElement;
|
||||
querySelector(selectors: "address"): HTMLElement;
|
||||
querySelector(selectors: "applet"): HTMLAppletElement;
|
||||
querySelector(selectors: "area"): HTMLAreaElement;
|
||||
querySelector(selectors: "article"): HTMLElement;
|
||||
querySelector(selectors: "aside"): HTMLElement;
|
||||
querySelector(selectors: "audio"): HTMLAudioElement;
|
||||
querySelector(selectors: "b"): HTMLElement;
|
||||
querySelector(selectors: "base"): HTMLBaseElement;
|
||||
querySelector(selectors: "basefont"): HTMLBaseFontElement;
|
||||
querySelector(selectors: "bdo"): HTMLElement;
|
||||
querySelector(selectors: "big"): HTMLElement;
|
||||
querySelector(selectors: "blockquote"): HTMLQuoteElement;
|
||||
querySelector(selectors: "body"): HTMLBodyElement;
|
||||
querySelector(selectors: "br"): HTMLBRElement;
|
||||
querySelector(selectors: "button"): HTMLButtonElement;
|
||||
querySelector(selectors: "canvas"): HTMLCanvasElement;
|
||||
querySelector(selectors: "caption"): HTMLTableCaptionElement;
|
||||
querySelector(selectors: "center"): HTMLElement;
|
||||
querySelector(selectors: "circle"): SVGCircleElement;
|
||||
querySelector(selectors: "cite"): HTMLElement;
|
||||
querySelector(selectors: "clippath"): SVGClipPathElement;
|
||||
querySelector(selectors: "code"): HTMLElement;
|
||||
querySelector(selectors: "col"): HTMLTableColElement;
|
||||
querySelector(selectors: "colgroup"): HTMLTableColElement;
|
||||
querySelector(selectors: "datalist"): HTMLDataListElement;
|
||||
querySelector(selectors: "dd"): HTMLElement;
|
||||
querySelector(selectors: "defs"): SVGDefsElement;
|
||||
querySelector(selectors: "del"): HTMLModElement;
|
||||
querySelector(selectors: "desc"): SVGDescElement;
|
||||
querySelector(selectors: "dfn"): HTMLElement;
|
||||
querySelector(selectors: "dir"): HTMLDirectoryElement;
|
||||
querySelector(selectors: "div"): HTMLDivElement;
|
||||
querySelector(selectors: "dl"): HTMLDListElement;
|
||||
querySelector(selectors: "dt"): HTMLElement;
|
||||
querySelector(selectors: "ellipse"): SVGEllipseElement;
|
||||
querySelector(selectors: "em"): HTMLElement;
|
||||
querySelector(selectors: "embed"): HTMLEmbedElement;
|
||||
querySelector(selectors: "feblend"): SVGFEBlendElement;
|
||||
querySelector(selectors: "fecolormatrix"): SVGFEColorMatrixElement;
|
||||
querySelector(selectors: "fecomponenttransfer"): SVGFEComponentTransferElement;
|
||||
querySelector(selectors: "fecomposite"): SVGFECompositeElement;
|
||||
querySelector(selectors: "feconvolvematrix"): SVGFEConvolveMatrixElement;
|
||||
querySelector(selectors: "fediffuselighting"): SVGFEDiffuseLightingElement;
|
||||
querySelector(selectors: "fedisplacementmap"): SVGFEDisplacementMapElement;
|
||||
querySelector(selectors: "fedistantlight"): SVGFEDistantLightElement;
|
||||
querySelector(selectors: "feflood"): SVGFEFloodElement;
|
||||
querySelector(selectors: "fefunca"): SVGFEFuncAElement;
|
||||
querySelector(selectors: "fefuncb"): SVGFEFuncBElement;
|
||||
querySelector(selectors: "fefuncg"): SVGFEFuncGElement;
|
||||
querySelector(selectors: "fefuncr"): SVGFEFuncRElement;
|
||||
querySelector(selectors: "fegaussianblur"): SVGFEGaussianBlurElement;
|
||||
querySelector(selectors: "feimage"): SVGFEImageElement;
|
||||
querySelector(selectors: "femerge"): SVGFEMergeElement;
|
||||
querySelector(selectors: "femergenode"): SVGFEMergeNodeElement;
|
||||
querySelector(selectors: "femorphology"): SVGFEMorphologyElement;
|
||||
querySelector(selectors: "feoffset"): SVGFEOffsetElement;
|
||||
querySelector(selectors: "fepointlight"): SVGFEPointLightElement;
|
||||
querySelector(selectors: "fespecularlighting"): SVGFESpecularLightingElement;
|
||||
querySelector(selectors: "fespotlight"): SVGFESpotLightElement;
|
||||
querySelector(selectors: "fetile"): SVGFETileElement;
|
||||
querySelector(selectors: "feturbulence"): SVGFETurbulenceElement;
|
||||
querySelector(selectors: "fieldset"): HTMLFieldSetElement;
|
||||
querySelector(selectors: "figcaption"): HTMLElement;
|
||||
querySelector(selectors: "figure"): HTMLElement;
|
||||
querySelector(selectors: "filter"): SVGFilterElement;
|
||||
querySelector(selectors: "font"): HTMLFontElement;
|
||||
querySelector(selectors: "footer"): HTMLElement;
|
||||
querySelector(selectors: "foreignobject"): SVGForeignObjectElement;
|
||||
querySelector(selectors: "form"): HTMLFormElement;
|
||||
querySelector(selectors: "frame"): HTMLFrameElement;
|
||||
querySelector(selectors: "frameset"): HTMLFrameSetElement;
|
||||
querySelector(selectors: "g"): SVGGElement;
|
||||
querySelector(selectors: "h1"): HTMLHeadingElement;
|
||||
querySelector(selectors: "h2"): HTMLHeadingElement;
|
||||
querySelector(selectors: "h3"): HTMLHeadingElement;
|
||||
querySelector(selectors: "h4"): HTMLHeadingElement;
|
||||
querySelector(selectors: "h5"): HTMLHeadingElement;
|
||||
querySelector(selectors: "h6"): HTMLHeadingElement;
|
||||
querySelector(selectors: "head"): HTMLHeadElement;
|
||||
querySelector(selectors: "header"): HTMLElement;
|
||||
querySelector(selectors: "hgroup"): HTMLElement;
|
||||
querySelector(selectors: "hr"): HTMLHRElement;
|
||||
querySelector(selectors: "html"): HTMLHtmlElement;
|
||||
querySelector(selectors: "i"): HTMLElement;
|
||||
querySelector(selectors: "iframe"): HTMLIFrameElement;
|
||||
querySelector(selectors: "image"): SVGImageElement;
|
||||
querySelector(selectors: "img"): HTMLImageElement;
|
||||
querySelector(selectors: "input"): HTMLInputElement;
|
||||
querySelector(selectors: "ins"): HTMLModElement;
|
||||
querySelector(selectors: "isindex"): HTMLUnknownElement;
|
||||
querySelector(selectors: "kbd"): HTMLElement;
|
||||
querySelector(selectors: "keygen"): HTMLElement;
|
||||
querySelector(selectors: "label"): HTMLLabelElement;
|
||||
querySelector(selectors: "legend"): HTMLLegendElement;
|
||||
querySelector(selectors: "li"): HTMLLIElement;
|
||||
querySelector(selectors: "line"): SVGLineElement;
|
||||
querySelector(selectors: "lineargradient"): SVGLinearGradientElement;
|
||||
querySelector(selectors: "link"): HTMLLinkElement;
|
||||
querySelector(selectors: "listing"): HTMLPreElement;
|
||||
querySelector(selectors: "map"): HTMLMapElement;
|
||||
querySelector(selectors: "mark"): HTMLElement;
|
||||
querySelector(selectors: "marker"): SVGMarkerElement;
|
||||
querySelector(selectors: "marquee"): HTMLMarqueeElement;
|
||||
querySelector(selectors: "mask"): SVGMaskElement;
|
||||
querySelector(selectors: "menu"): HTMLMenuElement;
|
||||
querySelector(selectors: "meta"): HTMLMetaElement;
|
||||
querySelector(selectors: "metadata"): SVGMetadataElement;
|
||||
querySelector(selectors: "meter"): HTMLMeterElement;
|
||||
querySelector(selectors: "nav"): HTMLElement;
|
||||
querySelector(selectors: "nextid"): HTMLUnknownElement;
|
||||
querySelector(selectors: "nobr"): HTMLElement;
|
||||
querySelector(selectors: "noframes"): HTMLElement;
|
||||
querySelector(selectors: "noscript"): HTMLElement;
|
||||
querySelector(selectors: "object"): HTMLObjectElement;
|
||||
querySelector(selectors: "ol"): HTMLOListElement;
|
||||
querySelector(selectors: "optgroup"): HTMLOptGroupElement;
|
||||
querySelector(selectors: "option"): HTMLOptionElement;
|
||||
querySelector(selectors: "p"): HTMLParagraphElement;
|
||||
querySelector(selectors: "param"): HTMLParamElement;
|
||||
querySelector(selectors: "path"): SVGPathElement;
|
||||
querySelector(selectors: "pattern"): SVGPatternElement;
|
||||
querySelector(selectors: "picture"): HTMLPictureElement;
|
||||
querySelector(selectors: "plaintext"): HTMLElement;
|
||||
querySelector(selectors: "polygon"): SVGPolygonElement;
|
||||
querySelector(selectors: "polyline"): SVGPolylineElement;
|
||||
querySelector(selectors: "pre"): HTMLPreElement;
|
||||
querySelector(selectors: "progress"): HTMLProgressElement;
|
||||
querySelector(selectors: "q"): HTMLQuoteElement;
|
||||
querySelector(selectors: "radialgradient"): SVGRadialGradientElement;
|
||||
querySelector(selectors: "rect"): SVGRectElement;
|
||||
querySelector(selectors: "rt"): HTMLElement;
|
||||
querySelector(selectors: "ruby"): HTMLElement;
|
||||
querySelector(selectors: "s"): HTMLElement;
|
||||
querySelector(selectors: "samp"): HTMLElement;
|
||||
querySelector(selectors: "script"): HTMLScriptElement;
|
||||
querySelector(selectors: "section"): HTMLElement;
|
||||
querySelector(selectors: "select"): HTMLSelectElement;
|
||||
querySelector(selectors: "small"): HTMLElement;
|
||||
querySelector(selectors: "source"): HTMLSourceElement;
|
||||
querySelector(selectors: "span"): HTMLSpanElement;
|
||||
querySelector(selectors: "stop"): SVGStopElement;
|
||||
querySelector(selectors: "strike"): HTMLElement;
|
||||
querySelector(selectors: "strong"): HTMLElement;
|
||||
querySelector(selectors: "style"): HTMLStyleElement;
|
||||
querySelector(selectors: "sub"): HTMLElement;
|
||||
querySelector(selectors: "sup"): HTMLElement;
|
||||
querySelector(selectors: "svg"): SVGSVGElement;
|
||||
querySelector(selectors: "switch"): SVGSwitchElement;
|
||||
querySelector(selectors: "symbol"): SVGSymbolElement;
|
||||
querySelector(selectors: "table"): HTMLTableElement;
|
||||
querySelector(selectors: "tbody"): HTMLTableSectionElement;
|
||||
querySelector(selectors: "td"): HTMLTableDataCellElement;
|
||||
querySelector(selectors: "template"): HTMLTemplateElement;
|
||||
querySelector(selectors: "text"): SVGTextElement;
|
||||
querySelector(selectors: "textpath"): SVGTextPathElement;
|
||||
querySelector(selectors: "textarea"): HTMLTextAreaElement;
|
||||
querySelector(selectors: "tfoot"): HTMLTableSectionElement;
|
||||
querySelector(selectors: "th"): HTMLTableHeaderCellElement;
|
||||
querySelector(selectors: "thead"): HTMLTableSectionElement;
|
||||
querySelector(selectors: "title"): HTMLTitleElement;
|
||||
querySelector(selectors: "tr"): HTMLTableRowElement;
|
||||
querySelector(selectors: "track"): HTMLTrackElement;
|
||||
querySelector(selectors: "tspan"): SVGTSpanElement;
|
||||
querySelector(selectors: "tt"): HTMLElement;
|
||||
querySelector(selectors: "u"): HTMLElement;
|
||||
querySelector(selectors: "ul"): HTMLUListElement;
|
||||
querySelector(selectors: "use"): SVGUseElement;
|
||||
querySelector(selectors: "var"): HTMLElement;
|
||||
querySelector(selectors: "video"): HTMLVideoElement;
|
||||
querySelector(selectors: "view"): SVGViewElement;
|
||||
querySelector(selectors: "wbr"): HTMLElement;
|
||||
querySelector(selectors: "x-ms-webview"): MSHTMLWebViewElement;
|
||||
querySelector(selectors: "xmp"): HTMLPreElement;
|
||||
querySelector(selectors: string): Element;
|
||||
querySelector(selectors: "a"): HTMLAnchorElement | null;
|
||||
querySelector(selectors: "abbr"): HTMLElement | null;
|
||||
querySelector(selectors: "acronym"): HTMLElement | null;
|
||||
querySelector(selectors: "address"): HTMLElement | null;
|
||||
querySelector(selectors: "applet"): HTMLAppletElement | null;
|
||||
querySelector(selectors: "area"): HTMLAreaElement | null;
|
||||
querySelector(selectors: "article"): HTMLElement | null;
|
||||
querySelector(selectors: "aside"): HTMLElement | null;
|
||||
querySelector(selectors: "audio"): HTMLAudioElement | null;
|
||||
querySelector(selectors: "b"): HTMLElement | null;
|
||||
querySelector(selectors: "base"): HTMLBaseElement | null;
|
||||
querySelector(selectors: "basefont"): HTMLBaseFontElement | null;
|
||||
querySelector(selectors: "bdo"): HTMLElement | null;
|
||||
querySelector(selectors: "big"): HTMLElement | null;
|
||||
querySelector(selectors: "blockquote"): HTMLQuoteElement | null;
|
||||
querySelector(selectors: "body"): HTMLBodyElement | null;
|
||||
querySelector(selectors: "br"): HTMLBRElement | null;
|
||||
querySelector(selectors: "button"): HTMLButtonElement | null;
|
||||
querySelector(selectors: "canvas"): HTMLCanvasElement | null;
|
||||
querySelector(selectors: "caption"): HTMLTableCaptionElement | null;
|
||||
querySelector(selectors: "center"): HTMLElement | null;
|
||||
querySelector(selectors: "circle"): SVGCircleElement | null;
|
||||
querySelector(selectors: "cite"): HTMLElement | null;
|
||||
querySelector(selectors: "clippath"): SVGClipPathElement | null;
|
||||
querySelector(selectors: "code"): HTMLElement | null;
|
||||
querySelector(selectors: "col"): HTMLTableColElement | null;
|
||||
querySelector(selectors: "colgroup"): HTMLTableColElement | null;
|
||||
querySelector(selectors: "datalist"): HTMLDataListElement | null;
|
||||
querySelector(selectors: "dd"): HTMLElement | null;
|
||||
querySelector(selectors: "defs"): SVGDefsElement | null;
|
||||
querySelector(selectors: "del"): HTMLModElement | null;
|
||||
querySelector(selectors: "desc"): SVGDescElement | null;
|
||||
querySelector(selectors: "dfn"): HTMLElement | null;
|
||||
querySelector(selectors: "dir"): HTMLDirectoryElement | null;
|
||||
querySelector(selectors: "div"): HTMLDivElement | null;
|
||||
querySelector(selectors: "dl"): HTMLDListElement | null;
|
||||
querySelector(selectors: "dt"): HTMLElement | null;
|
||||
querySelector(selectors: "ellipse"): SVGEllipseElement | null;
|
||||
querySelector(selectors: "em"): HTMLElement | null;
|
||||
querySelector(selectors: "embed"): HTMLEmbedElement | null;
|
||||
querySelector(selectors: "feblend"): SVGFEBlendElement | null;
|
||||
querySelector(selectors: "fecolormatrix"): SVGFEColorMatrixElement | null;
|
||||
querySelector(selectors: "fecomponenttransfer"): SVGFEComponentTransferElement | null;
|
||||
querySelector(selectors: "fecomposite"): SVGFECompositeElement | null;
|
||||
querySelector(selectors: "feconvolvematrix"): SVGFEConvolveMatrixElement | null;
|
||||
querySelector(selectors: "fediffuselighting"): SVGFEDiffuseLightingElement | null;
|
||||
querySelector(selectors: "fedisplacementmap"): SVGFEDisplacementMapElement | null;
|
||||
querySelector(selectors: "fedistantlight"): SVGFEDistantLightElement | null;
|
||||
querySelector(selectors: "feflood"): SVGFEFloodElement | null;
|
||||
querySelector(selectors: "fefunca"): SVGFEFuncAElement | null;
|
||||
querySelector(selectors: "fefuncb"): SVGFEFuncBElement | null;
|
||||
querySelector(selectors: "fefuncg"): SVGFEFuncGElement | null;
|
||||
querySelector(selectors: "fefuncr"): SVGFEFuncRElement | null;
|
||||
querySelector(selectors: "fegaussianblur"): SVGFEGaussianBlurElement | null;
|
||||
querySelector(selectors: "feimage"): SVGFEImageElement | null;
|
||||
querySelector(selectors: "femerge"): SVGFEMergeElement | null;
|
||||
querySelector(selectors: "femergenode"): SVGFEMergeNodeElement | null;
|
||||
querySelector(selectors: "femorphology"): SVGFEMorphologyElement | null;
|
||||
querySelector(selectors: "feoffset"): SVGFEOffsetElement | null;
|
||||
querySelector(selectors: "fepointlight"): SVGFEPointLightElement | null;
|
||||
querySelector(selectors: "fespecularlighting"): SVGFESpecularLightingElement | null;
|
||||
querySelector(selectors: "fespotlight"): SVGFESpotLightElement | null;
|
||||
querySelector(selectors: "fetile"): SVGFETileElement | null;
|
||||
querySelector(selectors: "feturbulence"): SVGFETurbulenceElement | null;
|
||||
querySelector(selectors: "fieldset"): HTMLFieldSetElement | null;
|
||||
querySelector(selectors: "figcaption"): HTMLElement | null;
|
||||
querySelector(selectors: "figure"): HTMLElement | null;
|
||||
querySelector(selectors: "filter"): SVGFilterElement | null;
|
||||
querySelector(selectors: "font"): HTMLFontElement | null;
|
||||
querySelector(selectors: "footer"): HTMLElement | null;
|
||||
querySelector(selectors: "foreignobject"): SVGForeignObjectElement | null;
|
||||
querySelector(selectors: "form"): HTMLFormElement | null;
|
||||
querySelector(selectors: "frame"): HTMLFrameElement | null;
|
||||
querySelector(selectors: "frameset"): HTMLFrameSetElement | null;
|
||||
querySelector(selectors: "g"): SVGGElement | null;
|
||||
querySelector(selectors: "h1"): HTMLHeadingElement | null;
|
||||
querySelector(selectors: "h2"): HTMLHeadingElement | null;
|
||||
querySelector(selectors: "h3"): HTMLHeadingElement | null;
|
||||
querySelector(selectors: "h4"): HTMLHeadingElement | null;
|
||||
querySelector(selectors: "h5"): HTMLHeadingElement | null;
|
||||
querySelector(selectors: "h6"): HTMLHeadingElement | null;
|
||||
querySelector(selectors: "head"): HTMLHeadElement | null;
|
||||
querySelector(selectors: "header"): HTMLElement | null;
|
||||
querySelector(selectors: "hgroup"): HTMLElement | null;
|
||||
querySelector(selectors: "hr"): HTMLHRElement | null;
|
||||
querySelector(selectors: "html"): HTMLHtmlElement | null;
|
||||
querySelector(selectors: "i"): HTMLElement | null;
|
||||
querySelector(selectors: "iframe"): HTMLIFrameElement | null;
|
||||
querySelector(selectors: "image"): SVGImageElement | null;
|
||||
querySelector(selectors: "img"): HTMLImageElement | null;
|
||||
querySelector(selectors: "input"): HTMLInputElement | null;
|
||||
querySelector(selectors: "ins"): HTMLModElement | null;
|
||||
querySelector(selectors: "isindex"): HTMLUnknownElement | null;
|
||||
querySelector(selectors: "kbd"): HTMLElement | null;
|
||||
querySelector(selectors: "keygen"): HTMLElement | null;
|
||||
querySelector(selectors: "label"): HTMLLabelElement | null;
|
||||
querySelector(selectors: "legend"): HTMLLegendElement | null;
|
||||
querySelector(selectors: "li"): HTMLLIElement | null;
|
||||
querySelector(selectors: "line"): SVGLineElement | null;
|
||||
querySelector(selectors: "lineargradient"): SVGLinearGradientElement | null;
|
||||
querySelector(selectors: "link"): HTMLLinkElement | null;
|
||||
querySelector(selectors: "listing"): HTMLPreElement | null;
|
||||
querySelector(selectors: "map"): HTMLMapElement | null;
|
||||
querySelector(selectors: "mark"): HTMLElement | null;
|
||||
querySelector(selectors: "marker"): SVGMarkerElement | null;
|
||||
querySelector(selectors: "marquee"): HTMLMarqueeElement | null;
|
||||
querySelector(selectors: "mask"): SVGMaskElement | null;
|
||||
querySelector(selectors: "menu"): HTMLMenuElement | null;
|
||||
querySelector(selectors: "meta"): HTMLMetaElement | null;
|
||||
querySelector(selectors: "metadata"): SVGMetadataElement | null;
|
||||
querySelector(selectors: "meter"): HTMLMeterElement | null;
|
||||
querySelector(selectors: "nav"): HTMLElement | null;
|
||||
querySelector(selectors: "nextid"): HTMLUnknownElement | null;
|
||||
querySelector(selectors: "nobr"): HTMLElement | null;
|
||||
querySelector(selectors: "noframes"): HTMLElement | null;
|
||||
querySelector(selectors: "noscript"): HTMLElement | null;
|
||||
querySelector(selectors: "object"): HTMLObjectElement | null;
|
||||
querySelector(selectors: "ol"): HTMLOListElement | null;
|
||||
querySelector(selectors: "optgroup"): HTMLOptGroupElement | null;
|
||||
querySelector(selectors: "option"): HTMLOptionElement | null;
|
||||
querySelector(selectors: "p"): HTMLParagraphElement | null;
|
||||
querySelector(selectors: "param"): HTMLParamElement | null;
|
||||
querySelector(selectors: "path"): SVGPathElement | null;
|
||||
querySelector(selectors: "pattern"): SVGPatternElement | null;
|
||||
querySelector(selectors: "picture"): HTMLPictureElement | null;
|
||||
querySelector(selectors: "plaintext"): HTMLElement | null;
|
||||
querySelector(selectors: "polygon"): SVGPolygonElement | null;
|
||||
querySelector(selectors: "polyline"): SVGPolylineElement | null;
|
||||
querySelector(selectors: "pre"): HTMLPreElement | null;
|
||||
querySelector(selectors: "progress"): HTMLProgressElement | null;
|
||||
querySelector(selectors: "q"): HTMLQuoteElement | null;
|
||||
querySelector(selectors: "radialgradient"): SVGRadialGradientElement | null;
|
||||
querySelector(selectors: "rect"): SVGRectElement | null;
|
||||
querySelector(selectors: "rt"): HTMLElement | null;
|
||||
querySelector(selectors: "ruby"): HTMLElement | null;
|
||||
querySelector(selectors: "s"): HTMLElement | null;
|
||||
querySelector(selectors: "samp"): HTMLElement | null;
|
||||
querySelector(selectors: "script"): HTMLScriptElement | null;
|
||||
querySelector(selectors: "section"): HTMLElement | null;
|
||||
querySelector(selectors: "select"): HTMLSelectElement | null;
|
||||
querySelector(selectors: "small"): HTMLElement | null;
|
||||
querySelector(selectors: "source"): HTMLSourceElement | null;
|
||||
querySelector(selectors: "span"): HTMLSpanElement | null;
|
||||
querySelector(selectors: "stop"): SVGStopElement | null;
|
||||
querySelector(selectors: "strike"): HTMLElement | null;
|
||||
querySelector(selectors: "strong"): HTMLElement | null;
|
||||
querySelector(selectors: "style"): HTMLStyleElement | null;
|
||||
querySelector(selectors: "sub"): HTMLElement | null;
|
||||
querySelector(selectors: "sup"): HTMLElement | null;
|
||||
querySelector(selectors: "svg"): SVGSVGElement | null;
|
||||
querySelector(selectors: "switch"): SVGSwitchElement | null;
|
||||
querySelector(selectors: "symbol"): SVGSymbolElement | null;
|
||||
querySelector(selectors: "table"): HTMLTableElement | null;
|
||||
querySelector(selectors: "tbody"): HTMLTableSectionElement | null;
|
||||
querySelector(selectors: "td"): HTMLTableDataCellElement | null;
|
||||
querySelector(selectors: "template"): HTMLTemplateElement | null;
|
||||
querySelector(selectors: "text"): SVGTextElement | null;
|
||||
querySelector(selectors: "textpath"): SVGTextPathElement | null;
|
||||
querySelector(selectors: "textarea"): HTMLTextAreaElement | null;
|
||||
querySelector(selectors: "tfoot"): HTMLTableSectionElement | null;
|
||||
querySelector(selectors: "th"): HTMLTableHeaderCellElement | null;
|
||||
querySelector(selectors: "thead"): HTMLTableSectionElement | null;
|
||||
querySelector(selectors: "title"): HTMLTitleElement | null;
|
||||
querySelector(selectors: "tr"): HTMLTableRowElement | null;
|
||||
querySelector(selectors: "track"): HTMLTrackElement | null;
|
||||
querySelector(selectors: "tspan"): SVGTSpanElement | null;
|
||||
querySelector(selectors: "tt"): HTMLElement | null;
|
||||
querySelector(selectors: "u"): HTMLElement | null;
|
||||
querySelector(selectors: "ul"): HTMLUListElement | null;
|
||||
querySelector(selectors: "use"): SVGUseElement | null;
|
||||
querySelector(selectors: "var"): HTMLElement | null;
|
||||
querySelector(selectors: "video"): HTMLVideoElement | null;
|
||||
querySelector(selectors: "view"): SVGViewElement | null;
|
||||
querySelector(selectors: "wbr"): HTMLElement | null;
|
||||
querySelector(selectors: "x-ms-webview"): MSHTMLWebViewElement | null;
|
||||
querySelector(selectors: "xmp"): HTMLPreElement | null;
|
||||
querySelector(selectors: string): Element | null;
|
||||
querySelectorAll(selectors: "a"): NodeListOf<HTMLAnchorElement>;
|
||||
querySelectorAll(selectors: "abbr"): NodeListOf<HTMLElement>;
|
||||
querySelectorAll(selectors: "acronym"): NodeListOf<HTMLElement>;
|
||||
@@ -14622,4 +14622,5 @@ type ScrollBehavior = "auto" | "instant" | "smooth";
|
||||
type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
|
||||
type IDBValidKey = number | string | Date | IDBArrayKey;
|
||||
type BufferSource = ArrayBuffer | ArrayBufferView;
|
||||
type MouseWheelEvent = WheelEvent;
|
||||
type MouseWheelEvent = WheelEvent;
|
||||
type ScrollRestoration = "auto" | "manual";
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
/// <reference path="lib.dom.generated.d.ts" />
|
||||
/// <reference path="lib.dom.d.ts" />
|
||||
|
||||
interface DOMTokenList {
|
||||
[Symbol.iterator](): IterableIterator<string>;
|
||||
|
||||
Vendored
+6
-6
@@ -728,7 +728,7 @@ declare var Worker: {
|
||||
}
|
||||
|
||||
interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
onreadystatechange: (this: this, ev: ProgressEvent) => any;
|
||||
onreadystatechange: (this: this, ev: Event) => any;
|
||||
readonly readyState: number;
|
||||
readonly response: any;
|
||||
readonly responseText: string;
|
||||
@@ -754,13 +754,13 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
readonly LOADING: number;
|
||||
readonly OPENED: number;
|
||||
readonly UNSENT: number;
|
||||
addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "abort", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "error", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "load", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "loadstart", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "readystatechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
@@ -678,6 +678,10 @@ namespace ts.server {
|
||||
throw new Error("SourceFile objects are not serializable through the server protocol.");
|
||||
}
|
||||
|
||||
getSourceFile(fileName: string): SourceFile {
|
||||
throw new Error("SourceFile objects are not serializable through the server protocol.");
|
||||
}
|
||||
|
||||
cleanupSemanticCache(): void {
|
||||
throw new Error("cleanupSemanticCache is not available through the server layer.");
|
||||
}
|
||||
|
||||
@@ -218,15 +218,13 @@ namespace ts.NavigationBar {
|
||||
break;
|
||||
|
||||
default:
|
||||
if (node.jsDocComments) {
|
||||
for (const jsDocComment of node.jsDocComments) {
|
||||
for (const tag of jsDocComment.tags) {
|
||||
if (tag.kind === SyntaxKind.JSDocTypedefTag) {
|
||||
addLeafNode(tag);
|
||||
}
|
||||
forEach(node.jsDocComments, jsDocComment => {
|
||||
forEach(jsDocComment.tags, tag => {
|
||||
if (tag.kind === SyntaxKind.JSDocTypedefTag) {
|
||||
addLeafNode(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
forEachChild(node, addChildrenRecursively);
|
||||
}
|
||||
|
||||
@@ -1401,6 +1401,10 @@ namespace ts {
|
||||
return syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
}
|
||||
|
||||
function getSourceFile(fileName: string): SourceFile {
|
||||
return getNonBoundSourceFile(fileName);
|
||||
}
|
||||
|
||||
function getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan {
|
||||
const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
|
||||
@@ -1812,6 +1816,7 @@ namespace ts {
|
||||
isValidBraceCompletionAtPosition,
|
||||
getEmitOutput,
|
||||
getNonBoundSourceFile,
|
||||
getSourceFile,
|
||||
getProgram
|
||||
};
|
||||
}
|
||||
|
||||
@@ -240,6 +240,12 @@ namespace ts {
|
||||
|
||||
/* @internal */ getNonBoundSourceFile(fileName: string): SourceFile;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @deprecated Use ts.createSourceFile instead.
|
||||
*/
|
||||
getSourceFile(fileName: string): SourceFile;
|
||||
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
//// [ambientConstLiterals.ts]
|
||||
|
||||
function f<T>(x: T): T {
|
||||
return x;
|
||||
}
|
||||
|
||||
enum E { A, B, C }
|
||||
|
||||
const c1 = "abc";
|
||||
const c2 = 123;
|
||||
const c3 = c1;
|
||||
const c4 = c2;
|
||||
const c5 = f(123);
|
||||
const c6 = f(-123);
|
||||
const c7 = true;
|
||||
const c8 = E.A;
|
||||
const c9 = { x: "abc" };
|
||||
const c10 = [123];
|
||||
const c11 = "abc" + "def";
|
||||
const c12 = 123 + 456;
|
||||
const c13 = Math.random() > 0.5 ? "abc" : "def";
|
||||
const c14 = Math.random() > 0.5 ? 123 : 456;
|
||||
|
||||
//// [ambientConstLiterals.js]
|
||||
function f(x) {
|
||||
return x;
|
||||
}
|
||||
var E;
|
||||
(function (E) {
|
||||
E[E["A"] = 0] = "A";
|
||||
E[E["B"] = 1] = "B";
|
||||
E[E["C"] = 2] = "C";
|
||||
})(E || (E = {}));
|
||||
var c1 = "abc";
|
||||
var c2 = 123;
|
||||
var c3 = c1;
|
||||
var c4 = c2;
|
||||
var c5 = f(123);
|
||||
var c6 = f(-123);
|
||||
var c7 = true;
|
||||
var c8 = E.A;
|
||||
var c9 = { x: "abc" };
|
||||
var c10 = [123];
|
||||
var c11 = "abc" + "def";
|
||||
var c12 = 123 + 456;
|
||||
var c13 = Math.random() > 0.5 ? "abc" : "def";
|
||||
var c14 = Math.random() > 0.5 ? 123 : 456;
|
||||
|
||||
|
||||
//// [ambientConstLiterals.d.ts]
|
||||
declare function f<T>(x: T): T;
|
||||
declare enum E {
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2,
|
||||
}
|
||||
declare const c1 = "abc";
|
||||
declare const c2 = 123;
|
||||
declare const c3 = "abc";
|
||||
declare const c4 = 123;
|
||||
declare const c5 = 123;
|
||||
declare const c6 = -123;
|
||||
declare const c7: boolean;
|
||||
declare const c8: E;
|
||||
declare const c9: {
|
||||
x: string;
|
||||
};
|
||||
declare const c10: number[];
|
||||
declare const c11: string;
|
||||
declare const c12: number;
|
||||
declare const c13: string;
|
||||
declare const c14: number;
|
||||
@@ -0,0 +1,75 @@
|
||||
=== tests/cases/compiler/ambientConstLiterals.ts ===
|
||||
|
||||
function f<T>(x: T): T {
|
||||
>f : Symbol(f, Decl(ambientConstLiterals.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(ambientConstLiterals.ts, 1, 11))
|
||||
>x : Symbol(x, Decl(ambientConstLiterals.ts, 1, 14))
|
||||
>T : Symbol(T, Decl(ambientConstLiterals.ts, 1, 11))
|
||||
>T : Symbol(T, Decl(ambientConstLiterals.ts, 1, 11))
|
||||
|
||||
return x;
|
||||
>x : Symbol(x, Decl(ambientConstLiterals.ts, 1, 14))
|
||||
}
|
||||
|
||||
enum E { A, B, C }
|
||||
>E : Symbol(E, Decl(ambientConstLiterals.ts, 3, 1))
|
||||
>A : Symbol(E.A, Decl(ambientConstLiterals.ts, 5, 8))
|
||||
>B : Symbol(E.B, Decl(ambientConstLiterals.ts, 5, 11))
|
||||
>C : Symbol(E.C, Decl(ambientConstLiterals.ts, 5, 14))
|
||||
|
||||
const c1 = "abc";
|
||||
>c1 : Symbol(c1, Decl(ambientConstLiterals.ts, 7, 5))
|
||||
|
||||
const c2 = 123;
|
||||
>c2 : Symbol(c2, Decl(ambientConstLiterals.ts, 8, 5))
|
||||
|
||||
const c3 = c1;
|
||||
>c3 : Symbol(c3, Decl(ambientConstLiterals.ts, 9, 5))
|
||||
>c1 : Symbol(c1, Decl(ambientConstLiterals.ts, 7, 5))
|
||||
|
||||
const c4 = c2;
|
||||
>c4 : Symbol(c4, Decl(ambientConstLiterals.ts, 10, 5))
|
||||
>c2 : Symbol(c2, Decl(ambientConstLiterals.ts, 8, 5))
|
||||
|
||||
const c5 = f(123);
|
||||
>c5 : Symbol(c5, Decl(ambientConstLiterals.ts, 11, 5))
|
||||
>f : Symbol(f, Decl(ambientConstLiterals.ts, 0, 0))
|
||||
|
||||
const c6 = f(-123);
|
||||
>c6 : Symbol(c6, Decl(ambientConstLiterals.ts, 12, 5))
|
||||
>f : Symbol(f, Decl(ambientConstLiterals.ts, 0, 0))
|
||||
|
||||
const c7 = true;
|
||||
>c7 : Symbol(c7, Decl(ambientConstLiterals.ts, 13, 5))
|
||||
|
||||
const c8 = E.A;
|
||||
>c8 : Symbol(c8, Decl(ambientConstLiterals.ts, 14, 5))
|
||||
>E.A : Symbol(E.A, Decl(ambientConstLiterals.ts, 5, 8))
|
||||
>E : Symbol(E, Decl(ambientConstLiterals.ts, 3, 1))
|
||||
>A : Symbol(E.A, Decl(ambientConstLiterals.ts, 5, 8))
|
||||
|
||||
const c9 = { x: "abc" };
|
||||
>c9 : Symbol(c9, Decl(ambientConstLiterals.ts, 15, 5))
|
||||
>x : Symbol(x, Decl(ambientConstLiterals.ts, 15, 12))
|
||||
|
||||
const c10 = [123];
|
||||
>c10 : Symbol(c10, Decl(ambientConstLiterals.ts, 16, 5))
|
||||
|
||||
const c11 = "abc" + "def";
|
||||
>c11 : Symbol(c11, Decl(ambientConstLiterals.ts, 17, 5))
|
||||
|
||||
const c12 = 123 + 456;
|
||||
>c12 : Symbol(c12, Decl(ambientConstLiterals.ts, 18, 5))
|
||||
|
||||
const c13 = Math.random() > 0.5 ? "abc" : "def";
|
||||
>c13 : Symbol(c13, Decl(ambientConstLiterals.ts, 19, 5))
|
||||
>Math.random : Symbol(Math.random, Decl(lib.d.ts, --, --))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>random : Symbol(Math.random, Decl(lib.d.ts, --, --))
|
||||
|
||||
const c14 = Math.random() > 0.5 ? 123 : 456;
|
||||
>c14 : Symbol(c14, Decl(ambientConstLiterals.ts, 20, 5))
|
||||
>Math.random : Symbol(Math.random, Decl(lib.d.ts, --, --))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>random : Symbol(Math.random, Decl(lib.d.ts, --, --))
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
=== tests/cases/compiler/ambientConstLiterals.ts ===
|
||||
|
||||
function f<T>(x: T): T {
|
||||
>f : <T>(x: T) => T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
return x;
|
||||
>x : T
|
||||
}
|
||||
|
||||
enum E { A, B, C }
|
||||
>E : E
|
||||
>A : E.A
|
||||
>B : E.B
|
||||
>C : E.C
|
||||
|
||||
const c1 = "abc";
|
||||
>c1 : "abc"
|
||||
>"abc" : "abc"
|
||||
|
||||
const c2 = 123;
|
||||
>c2 : 123
|
||||
>123 : 123
|
||||
|
||||
const c3 = c1;
|
||||
>c3 : "abc"
|
||||
>c1 : "abc"
|
||||
|
||||
const c4 = c2;
|
||||
>c4 : 123
|
||||
>c2 : 123
|
||||
|
||||
const c5 = f(123);
|
||||
>c5 : 123
|
||||
>f(123) : 123
|
||||
>f : <T>(x: T) => T
|
||||
>123 : 123
|
||||
|
||||
const c6 = f(-123);
|
||||
>c6 : -123
|
||||
>f(-123) : -123
|
||||
>f : <T>(x: T) => T
|
||||
>-123 : -123
|
||||
>123 : 123
|
||||
|
||||
const c7 = true;
|
||||
>c7 : true
|
||||
>true : true
|
||||
|
||||
const c8 = E.A;
|
||||
>c8 : E.A
|
||||
>E.A : E.A
|
||||
>E : typeof E
|
||||
>A : E.A
|
||||
|
||||
const c9 = { x: "abc" };
|
||||
>c9 : { x: string; }
|
||||
>{ x: "abc" } : { x: string; }
|
||||
>x : string
|
||||
>"abc" : "abc"
|
||||
|
||||
const c10 = [123];
|
||||
>c10 : number[]
|
||||
>[123] : number[]
|
||||
>123 : 123
|
||||
|
||||
const c11 = "abc" + "def";
|
||||
>c11 : string
|
||||
>"abc" + "def" : string
|
||||
>"abc" : "abc"
|
||||
>"def" : "def"
|
||||
|
||||
const c12 = 123 + 456;
|
||||
>c12 : number
|
||||
>123 + 456 : number
|
||||
>123 : 123
|
||||
>456 : 456
|
||||
|
||||
const c13 = Math.random() > 0.5 ? "abc" : "def";
|
||||
>c13 : "abc" | "def"
|
||||
>Math.random() > 0.5 ? "abc" : "def" : "abc" | "def"
|
||||
>Math.random() > 0.5 : boolean
|
||||
>Math.random() : number
|
||||
>Math.random : () => number
|
||||
>Math : Math
|
||||
>random : () => number
|
||||
>0.5 : 0.5
|
||||
>"abc" : "abc"
|
||||
>"def" : "def"
|
||||
|
||||
const c14 = Math.random() > 0.5 ? 123 : 456;
|
||||
>c14 : 123 | 456
|
||||
>Math.random() > 0.5 ? 123 : 456 : 123 | 456
|
||||
>Math.random() > 0.5 : boolean
|
||||
>Math.random() : number
|
||||
>Math.random : () => number
|
||||
>Math : Math
|
||||
>random : () => number
|
||||
>0.5 : 0.5
|
||||
>123 : 123
|
||||
>456 : 456
|
||||
|
||||
@@ -46,7 +46,7 @@ class parser {
|
||||
>this : this
|
||||
>options : IOptions[]
|
||||
>sort : (compareFn?: (a: IOptions, b: IOptions) => number) => IOptions[]
|
||||
>function(a, b) { var aName = a.name.toLowerCase(); var bName = b.name.toLowerCase(); if (aName > bName) { return 1; } else if (aName < bName) { return -1; } else { return 0; } } : (a: IOptions, b: IOptions) => 0 | 1 | -1
|
||||
>function(a, b) { var aName = a.name.toLowerCase(); var bName = b.name.toLowerCase(); if (aName > bName) { return 1; } else if (aName < bName) { return -1; } else { return 0; } } : (a: IOptions, b: IOptions) => 1 | -1 | 0
|
||||
>a : IOptions
|
||||
>b : IOptions
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
tests/cases/compiler/assigningFromObjectToAnythingElse.ts(3,1): error TS2322: Type 'Object' is not assignable to type 'RegExp'.
|
||||
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
Property 'exec' is missing in type 'Object'.
|
||||
tests/cases/compiler/assigningFromObjectToAnythingElse.ts(5,5): error TS2322: Type 'Object' is not assignable to type 'String'.
|
||||
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
Property 'charAt' is missing in type 'Object'.
|
||||
tests/cases/compiler/assigningFromObjectToAnythingElse.ts(6,5): error TS2322: Type 'Number' is not assignable to type 'String'.
|
||||
Property 'charAt' is missing in type 'Number'.
|
||||
tests/cases/compiler/assigningFromObjectToAnythingElse.ts(8,5): error TS2322: Type 'Object' is not assignable to type 'Error'.
|
||||
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
Property 'name' is missing in type 'Object'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assigningFromObjectToAnythingElse.ts (4 errors) ====
|
||||
var x: Object;
|
||||
var y: RegExp;
|
||||
y = x;
|
||||
~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'RegExp'.
|
||||
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
!!! error TS2322: Property 'exec' is missing in type 'Object'.
|
||||
|
||||
var a: String = Object.create<Object>("");
|
||||
~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'String'.
|
||||
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
!!! error TS2322: Property 'charAt' is missing in type 'Object'.
|
||||
var c: String = Object.create<Number>(1);
|
||||
~
|
||||
!!! error TS2322: Type 'Number' is not assignable to type 'String'.
|
||||
!!! error TS2322: Property 'charAt' is missing in type 'Number'.
|
||||
|
||||
var w: Error = new Object();
|
||||
~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'Error'.
|
||||
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
!!! error TS2322: Property 'name' is missing in type 'Object'.
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [assigningFromObjectToAnythingElse.ts]
|
||||
var x: Object;
|
||||
var y: RegExp;
|
||||
y = x;
|
||||
|
||||
var a: String = Object.create<Object>("");
|
||||
var c: String = Object.create<Number>(1);
|
||||
|
||||
var w: Error = new Object();
|
||||
|
||||
|
||||
//// [assigningFromObjectToAnythingElse.js]
|
||||
var x;
|
||||
var y;
|
||||
y = x;
|
||||
var a = Object.create("");
|
||||
var c = Object.create(1);
|
||||
var w = new Object();
|
||||
@@ -9,7 +9,7 @@ var bar = async (): Promise<void> => {
|
||||
//// [asyncArrowFunction7_es5.js]
|
||||
var _this = this;
|
||||
var bar = function () { return __awaiter(_this, void 0, void 0, function () {
|
||||
_this = this;
|
||||
var _this = this;
|
||||
var foo;
|
||||
return __generator(this, function (_a) {
|
||||
foo = function (a) {
|
||||
@@ -22,4 +22,4 @@ var bar = function () { return __awaiter(_this, void 0, void 0, function () {
|
||||
};
|
||||
return [2 /*return*/];
|
||||
});
|
||||
}); var _this; };
|
||||
}); };
|
||||
|
||||
@@ -30,7 +30,7 @@ var derived2: Derived2;
|
||||
|
||||
var r2 = true ? 1 : '';
|
||||
>r2 : string | number
|
||||
>true ? 1 : '' : "" | 1
|
||||
>true ? 1 : '' : 1 | ""
|
||||
>true : true
|
||||
>1 : 1
|
||||
>'' : ""
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//// [blockScopedBindingCaptureThisInFunction.ts]
|
||||
// https://github.com/Microsoft/TypeScript/issues/11038
|
||||
() => function () {
|
||||
for (let someKey in {}) {
|
||||
this.helloWorld();
|
||||
() => someKey;
|
||||
}
|
||||
};
|
||||
|
||||
//// [blockScopedBindingCaptureThisInFunction.js]
|
||||
// https://github.com/Microsoft/TypeScript/issues/11038
|
||||
(function () { return function () {
|
||||
var _loop_1 = function (someKey) {
|
||||
this_1.helloWorld();
|
||||
(function () { return someKey; });
|
||||
};
|
||||
var this_1 = this;
|
||||
for (var someKey in {}) {
|
||||
_loop_1(someKey);
|
||||
}
|
||||
}; });
|
||||
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/compiler/blockScopedBindingCaptureThisInFunction.ts ===
|
||||
// https://github.com/Microsoft/TypeScript/issues/11038
|
||||
() => function () {
|
||||
for (let someKey in {}) {
|
||||
>someKey : Symbol(someKey, Decl(blockScopedBindingCaptureThisInFunction.ts, 2, 12))
|
||||
|
||||
this.helloWorld();
|
||||
() => someKey;
|
||||
>someKey : Symbol(someKey, Decl(blockScopedBindingCaptureThisInFunction.ts, 2, 12))
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
=== tests/cases/compiler/blockScopedBindingCaptureThisInFunction.ts ===
|
||||
// https://github.com/Microsoft/TypeScript/issues/11038
|
||||
() => function () {
|
||||
>() => function () { for (let someKey in {}) { this.helloWorld(); () => someKey; }} : () => () => void
|
||||
>function () { for (let someKey in {}) { this.helloWorld(); () => someKey; }} : () => void
|
||||
|
||||
for (let someKey in {}) {
|
||||
>someKey : string
|
||||
>{} : {}
|
||||
|
||||
this.helloWorld();
|
||||
>this.helloWorld() : any
|
||||
>this.helloWorld : any
|
||||
>this : any
|
||||
>helloWorld : any
|
||||
|
||||
() => someKey;
|
||||
>() => someKey : () => string
|
||||
>someKey : string
|
||||
}
|
||||
};
|
||||
@@ -19,7 +19,7 @@ declare function foo<T>(obj: I<T>): T
|
||||
foo({
|
||||
>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | (() => void) | number[]
|
||||
>foo : <T>(obj: I<T>) => T
|
||||
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: true | "" | 0 | (() => void) | number[]; [x: number]: 0 | (() => void) | number[]; 0: () => void; p: ""; }
|
||||
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: true | "" | (() => void) | 0 | number[]; [x: number]: (() => void) | 0 | number[]; 0: () => void; p: ""; }
|
||||
|
||||
p: "",
|
||||
>p : string
|
||||
|
||||
@@ -19,7 +19,7 @@ declare function foo<T>(obj: I<T>): T
|
||||
foo({
|
||||
>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | (() => void) | number[]
|
||||
>foo : <T>(obj: I<T>) => T
|
||||
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: true | "" | 0 | (() => void) | number[]; [x: number]: 0 | (() => void) | number[]; 0: () => void; p: ""; }
|
||||
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: true | "" | (() => void) | 0 | number[]; [x: number]: (() => void) | 0 | number[]; 0: () => void; p: ""; }
|
||||
|
||||
p: "",
|
||||
>p : string
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/compiler/conditionalExpression1.ts(1,5): error TS2322: Type '"" | 1' is not assignable to type 'boolean'.
|
||||
Type '""' is not assignable to type 'boolean'.
|
||||
tests/cases/compiler/conditionalExpression1.ts(1,5): error TS2322: Type '1 | ""' is not assignable to type 'boolean'.
|
||||
Type '1' is not assignable to type 'boolean'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/conditionalExpression1.ts (1 errors) ====
|
||||
var x: boolean = (true ? 1 : ""); // should be an error
|
||||
~
|
||||
!!! error TS2322: Type '"" | 1' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type '""' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type '1 | ""' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type '1' is not assignable to type 'boolean'.
|
||||
@@ -16,7 +16,7 @@ var b = false ? undefined : 0;
|
||||
|
||||
var c = false ? 1 : 0;
|
||||
>c : number
|
||||
>false ? 1 : 0 : 0 | 1
|
||||
>false ? 1 : 0 : 1 | 0
|
||||
>false : false
|
||||
>1 : 1
|
||||
>0 : 0
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
tests/cases/compiler/constDeclarations-ambient-errors.ts(3,27): error TS1039: Initializers are not allowed in ambient contexts.
|
||||
tests/cases/compiler/constDeclarations-ambient-errors.ts(4,26): error TS1039: Initializers are not allowed in ambient contexts.
|
||||
tests/cases/compiler/constDeclarations-ambient-errors.ts(5,18): error TS1039: Initializers are not allowed in ambient contexts.
|
||||
tests/cases/compiler/constDeclarations-ambient-errors.ts(5,20): error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal.
|
||||
tests/cases/compiler/constDeclarations-ambient-errors.ts(5,37): error TS1039: Initializers are not allowed in ambient contexts.
|
||||
tests/cases/compiler/constDeclarations-ambient-errors.ts(5,51): error TS1039: Initializers are not allowed in ambient contexts.
|
||||
tests/cases/compiler/constDeclarations-ambient-errors.ts(8,14): error TS1039: Initializers are not allowed in ambient contexts.
|
||||
tests/cases/compiler/constDeclarations-ambient-errors.ts(9,22): error TS1039: Initializers are not allowed in ambient contexts.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constDeclarations-ambient-errors.ts (7 errors) ====
|
||||
==== tests/cases/compiler/constDeclarations-ambient-errors.ts (6 errors) ====
|
||||
|
||||
// error: no intialization expected in ambient declarations
|
||||
declare const c1: boolean = true;
|
||||
@@ -17,8 +16,8 @@ tests/cases/compiler/constDeclarations-ambient-errors.ts(9,22): error TS1039: In
|
||||
~
|
||||
!!! error TS1039: Initializers are not allowed in ambient contexts.
|
||||
declare const c3 = null, c4 :string = "", c5: any = 0;
|
||||
~
|
||||
!!! error TS1039: Initializers are not allowed in ambient contexts.
|
||||
~~~~
|
||||
!!! error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal.
|
||||
~
|
||||
!!! error TS1039: Initializers are not allowed in ambient contexts.
|
||||
~
|
||||
@@ -26,8 +25,6 @@ tests/cases/compiler/constDeclarations-ambient-errors.ts(9,22): error TS1039: In
|
||||
|
||||
declare module M {
|
||||
const c6 = 0;
|
||||
~
|
||||
!!! error TS1039: Initializers are not allowed in ambient contexts.
|
||||
const c7: number = 7;
|
||||
~
|
||||
!!! error TS1039: Initializers are not allowed in ambient contexts.
|
||||
|
||||
@@ -25,6 +25,6 @@ for (const c5 = 0, c6 = 0; c5 < c6;) {
|
||||
|
||||
|
||||
//// [constDeclarations.d.ts]
|
||||
declare const c1: false;
|
||||
declare const c1: boolean;
|
||||
declare const c2: number;
|
||||
declare const c3: 0, c4: string, c5: any;
|
||||
declare const c3 = 0, c4: string, c5: any;
|
||||
|
||||
@@ -20,7 +20,7 @@ var M;
|
||||
|
||||
//// [constDeclarations2.d.ts]
|
||||
declare module M {
|
||||
const c1: false;
|
||||
const c1: boolean;
|
||||
const c2: number;
|
||||
const c3: 0, c4: string, c5: any;
|
||||
const c3 = 0, c4: string, c5: any;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ var y = [() => new c()];
|
||||
var k: (() => c) | string = (() => new c()) || "";
|
||||
>k : string | (() => c)
|
||||
>c : c
|
||||
>(() => new c()) || "" : "" | (() => c)
|
||||
>(() => new c()) || "" : (() => c) | ""
|
||||
>(() => new c()) : () => c
|
||||
>() => new c() : () => c
|
||||
>new c() : c
|
||||
|
||||
@@ -45,7 +45,7 @@ var Foo = (function () {
|
||||
|
||||
|
||||
//// [declarationEmitClassMemberNameConflict2.d.ts]
|
||||
declare const Bar: "bar";
|
||||
declare const Bar = "bar";
|
||||
declare enum Hello {
|
||||
World = 0,
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
//// [tests/cases/compiler/es6UseOfTopLevelRequire.ts] ////
|
||||
|
||||
//// [b.ts]
|
||||
|
||||
export default function require(s: string): void {
|
||||
}
|
||||
|
||||
//// [c.ts]
|
||||
export const exports = 0;
|
||||
export default exports;
|
||||
|
||||
//// [a.ts]
|
||||
import require from "./b"
|
||||
require("arg");
|
||||
|
||||
import exports from "./c"
|
||||
var x = exports + 2;
|
||||
|
||||
|
||||
//// [b.js]
|
||||
export default function require(s) {
|
||||
}
|
||||
//// [c.js]
|
||||
export const exports = 0;
|
||||
export default exports;
|
||||
//// [a.js]
|
||||
import require from "./b";
|
||||
require("arg");
|
||||
import exports from "./c";
|
||||
var x = exports + 2;
|
||||
@@ -0,0 +1,28 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import require from "./b"
|
||||
>require : Symbol(require, Decl(a.ts, 0, 6))
|
||||
|
||||
require("arg");
|
||||
>require : Symbol(require, Decl(a.ts, 0, 6))
|
||||
|
||||
import exports from "./c"
|
||||
>exports : Symbol(exports, Decl(a.ts, 3, 6))
|
||||
|
||||
var x = exports + 2;
|
||||
>x : Symbol(x, Decl(a.ts, 4, 3))
|
||||
>exports : Symbol(exports, Decl(a.ts, 3, 6))
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
|
||||
export default function require(s: string): void {
|
||||
>require : Symbol(require, Decl(b.ts, 0, 0))
|
||||
>s : Symbol(s, Decl(b.ts, 1, 32))
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/c.ts ===
|
||||
export const exports = 0;
|
||||
>exports : Symbol(exports, Decl(c.ts, 0, 12))
|
||||
|
||||
export default exports;
|
||||
>exports : Symbol(exports, Decl(c.ts, 0, 12))
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import require from "./b"
|
||||
>require : (s: string) => void
|
||||
|
||||
require("arg");
|
||||
>require("arg") : void
|
||||
>require : (s: string) => void
|
||||
>"arg" : "arg"
|
||||
|
||||
import exports from "./c"
|
||||
>exports : 0
|
||||
|
||||
var x = exports + 2;
|
||||
>x : number
|
||||
>exports + 2 : number
|
||||
>exports : 0
|
||||
>2 : 2
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
|
||||
export default function require(s: string): void {
|
||||
>require : (s: string) => void
|
||||
>s : string
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/c.ts ===
|
||||
export const exports = 0;
|
||||
>exports : 0
|
||||
>0 : 0
|
||||
|
||||
export default exports;
|
||||
>exports : 0
|
||||
|
||||
@@ -11,15 +11,15 @@ export default function f3(d = 0) {
|
||||
|
||||
|
||||
//// [es6modulekindWithES5Target6.js]
|
||||
function f1(d) {
|
||||
export function f1(d) {
|
||||
if (d === void 0) { d = 0; }
|
||||
}
|
||||
function f2() {
|
||||
export function f2() {
|
||||
var arg = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
arg[_i - 0] = arguments[_i];
|
||||
}
|
||||
}
|
||||
function f3(d) {
|
||||
export default function f3(d) {
|
||||
if (d === void 0) { d = 0; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [forOfTransformsExpression.ts]
|
||||
// https://github.com/Microsoft/TypeScript/issues/11024
|
||||
let items = [{ name: "A" }, { name: "C" }, { name: "B" }];
|
||||
for (var item of items.sort((a, b) => a.name.localeCompare(b.name))) {
|
||||
|
||||
}
|
||||
|
||||
//// [forOfTransformsExpression.js]
|
||||
// https://github.com/Microsoft/TypeScript/issues/11024
|
||||
var items = [{ name: "A" }, { name: "C" }, { name: "B" }];
|
||||
for (var _i = 0, _a = items.sort(function (a, b) { return a.name.localeCompare(b.name); }); _i < _a.length; _i++) {
|
||||
var item = _a[_i];
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
=== tests/cases/compiler/forOfTransformsExpression.ts ===
|
||||
// https://github.com/Microsoft/TypeScript/issues/11024
|
||||
let items = [{ name: "A" }, { name: "C" }, { name: "B" }];
|
||||
>items : Symbol(items, Decl(forOfTransformsExpression.ts, 1, 3))
|
||||
>name : Symbol(name, Decl(forOfTransformsExpression.ts, 1, 14))
|
||||
>name : Symbol(name, Decl(forOfTransformsExpression.ts, 1, 29))
|
||||
>name : Symbol(name, Decl(forOfTransformsExpression.ts, 1, 44))
|
||||
|
||||
for (var item of items.sort((a, b) => a.name.localeCompare(b.name))) {
|
||||
>item : Symbol(item, Decl(forOfTransformsExpression.ts, 2, 8))
|
||||
>items.sort : Symbol(Array.sort, Decl(lib.d.ts, --, --))
|
||||
>items : Symbol(items, Decl(forOfTransformsExpression.ts, 1, 3))
|
||||
>sort : Symbol(Array.sort, Decl(lib.d.ts, --, --))
|
||||
>a : Symbol(a, Decl(forOfTransformsExpression.ts, 2, 29))
|
||||
>b : Symbol(b, Decl(forOfTransformsExpression.ts, 2, 31))
|
||||
>a.name.localeCompare : Symbol(String.localeCompare, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>a.name : Symbol(name, Decl(forOfTransformsExpression.ts, 1, 14))
|
||||
>a : Symbol(a, Decl(forOfTransformsExpression.ts, 2, 29))
|
||||
>name : Symbol(name, Decl(forOfTransformsExpression.ts, 1, 14))
|
||||
>localeCompare : Symbol(String.localeCompare, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>b.name : Symbol(name, Decl(forOfTransformsExpression.ts, 1, 14))
|
||||
>b : Symbol(b, Decl(forOfTransformsExpression.ts, 2, 31))
|
||||
>name : Symbol(name, Decl(forOfTransformsExpression.ts, 1, 14))
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
=== tests/cases/compiler/forOfTransformsExpression.ts ===
|
||||
// https://github.com/Microsoft/TypeScript/issues/11024
|
||||
let items = [{ name: "A" }, { name: "C" }, { name: "B" }];
|
||||
>items : { name: string; }[]
|
||||
>[{ name: "A" }, { name: "C" }, { name: "B" }] : { name: string; }[]
|
||||
>{ name: "A" } : { name: string; }
|
||||
>name : string
|
||||
>"A" : "A"
|
||||
>{ name: "C" } : { name: string; }
|
||||
>name : string
|
||||
>"C" : "C"
|
||||
>{ name: "B" } : { name: string; }
|
||||
>name : string
|
||||
>"B" : "B"
|
||||
|
||||
for (var item of items.sort((a, b) => a.name.localeCompare(b.name))) {
|
||||
>item : { name: string; }
|
||||
>items.sort((a, b) => a.name.localeCompare(b.name)) : { name: string; }[]
|
||||
>items.sort : (compareFn?: (a: { name: string; }, b: { name: string; }) => number) => { name: string; }[]
|
||||
>items : { name: string; }[]
|
||||
>sort : (compareFn?: (a: { name: string; }, b: { name: string; }) => number) => { name: string; }[]
|
||||
>(a, b) => a.name.localeCompare(b.name) : (a: { name: string; }, b: { name: string; }) => number
|
||||
>a : { name: string; }
|
||||
>b : { name: string; }
|
||||
>a.name.localeCompare(b.name) : number
|
||||
>a.name.localeCompare : { (that: string): number; (that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; }
|
||||
>a.name : string
|
||||
>a : { name: string; }
|
||||
>name : string
|
||||
>localeCompare : { (that: string): number; (that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; }
|
||||
>b.name : string
|
||||
>b : { name: string; }
|
||||
>name : string
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
// it is an error if there is no single BCT, these are error cases
|
||||
|
||||
function f1() {
|
||||
>f1 : () => "" | 1
|
||||
>f1 : () => 1 | ""
|
||||
|
||||
if (true) {
|
||||
>true : true
|
||||
@@ -19,7 +19,7 @@ function f1() {
|
||||
}
|
||||
|
||||
function f2() {
|
||||
>f2 : () => "" | 1 | 2
|
||||
>f2 : () => 1 | "" | 2
|
||||
|
||||
if (true) {
|
||||
>true : true
|
||||
@@ -40,7 +40,7 @@ function f2() {
|
||||
}
|
||||
|
||||
function f3() {
|
||||
>f3 : () => "" | 1
|
||||
>f3 : () => 1 | ""
|
||||
|
||||
try {
|
||||
return 1;
|
||||
@@ -55,7 +55,7 @@ function f3() {
|
||||
}
|
||||
|
||||
function f4() {
|
||||
>f4 : () => "" | 1
|
||||
>f4 : () => 1 | ""
|
||||
|
||||
try {
|
||||
return 1;
|
||||
@@ -72,7 +72,7 @@ function f4() {
|
||||
}
|
||||
|
||||
function f5() {
|
||||
>f5 : () => "" | 1
|
||||
>f5 : () => 1 | ""
|
||||
|
||||
return 1;
|
||||
>1 : 1
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
|
||||
//// [functionsWithModifiersInBlocks1.js]
|
||||
{
|
||||
function f() { }
|
||||
export function f() { }
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ tests/cases/compiler/intTypeCheck.ts(35,6): error TS2304: Cannot find name 'p'.
|
||||
tests/cases/compiler/intTypeCheck.ts(71,6): error TS2304: Cannot find name 'p'.
|
||||
tests/cases/compiler/intTypeCheck.ts(85,5): error TS2386: Overload signatures must all be optional or required.
|
||||
tests/cases/compiler/intTypeCheck.ts(99,5): error TS2322: Type 'Object' is not assignable to type 'i1'.
|
||||
Property 'p' is missing in type 'Object'.
|
||||
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
Property 'p' is missing in type 'Object'.
|
||||
tests/cases/compiler/intTypeCheck.ts(100,16): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(101,5): error TS2322: Type 'Base' is not assignable to type 'i1'.
|
||||
Property 'p' is missing in type 'Base'.
|
||||
@@ -15,7 +16,8 @@ tests/cases/compiler/intTypeCheck.ts(107,17): error TS2351: Cannot use 'new' wit
|
||||
tests/cases/compiler/intTypeCheck.ts(112,5): error TS2322: Type '{}' is not assignable to type 'i2'.
|
||||
Type '{}' provides no match for the signature '(): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(113,5): error TS2322: Type 'Object' is not assignable to type 'i2'.
|
||||
Type 'Object' provides no match for the signature '(): any'
|
||||
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
Type 'Object' provides no match for the signature '(): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(114,17): error TS2350: Only a void function can be called with the 'new' keyword.
|
||||
tests/cases/compiler/intTypeCheck.ts(115,5): error TS2322: Type 'Base' is not assignable to type 'i2'.
|
||||
Type 'Base' provides no match for the signature '(): any'
|
||||
@@ -26,7 +28,8 @@ tests/cases/compiler/intTypeCheck.ts(121,17): error TS2351: Cannot use 'new' wit
|
||||
tests/cases/compiler/intTypeCheck.ts(126,5): error TS2322: Type '{}' is not assignable to type 'i3'.
|
||||
Type '{}' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(127,5): error TS2322: Type 'Object' is not assignable to type 'i3'.
|
||||
Type 'Object' provides no match for the signature 'new (): any'
|
||||
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
Type 'Object' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(129,5): error TS2322: Type 'Base' is not assignable to type 'i3'.
|
||||
Type 'Base' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(131,5): error TS2322: Type '() => void' is not assignable to type 'i3'.
|
||||
@@ -43,7 +46,8 @@ tests/cases/compiler/intTypeCheck.ts(149,17): error TS2351: Cannot use 'new' wit
|
||||
tests/cases/compiler/intTypeCheck.ts(154,5): error TS2322: Type '{}' is not assignable to type 'i5'.
|
||||
Property 'p' is missing in type '{}'.
|
||||
tests/cases/compiler/intTypeCheck.ts(155,5): error TS2322: Type 'Object' is not assignable to type 'i5'.
|
||||
Property 'p' is missing in type 'Object'.
|
||||
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
Property 'p' is missing in type 'Object'.
|
||||
tests/cases/compiler/intTypeCheck.ts(156,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(157,5): error TS2322: Type 'Base' is not assignable to type 'i5'.
|
||||
Property 'p' is missing in type 'Base'.
|
||||
@@ -56,7 +60,8 @@ tests/cases/compiler/intTypeCheck.ts(163,17): error TS2351: Cannot use 'new' wit
|
||||
tests/cases/compiler/intTypeCheck.ts(168,5): error TS2322: Type '{}' is not assignable to type 'i6'.
|
||||
Type '{}' provides no match for the signature '(): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(169,5): error TS2322: Type 'Object' is not assignable to type 'i6'.
|
||||
Type 'Object' provides no match for the signature '(): any'
|
||||
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
Type 'Object' provides no match for the signature '(): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(170,17): error TS2350: Only a void function can be called with the 'new' keyword.
|
||||
tests/cases/compiler/intTypeCheck.ts(171,5): error TS2322: Type 'Base' is not assignable to type 'i6'.
|
||||
Type 'Base' provides no match for the signature '(): any'
|
||||
@@ -69,7 +74,8 @@ tests/cases/compiler/intTypeCheck.ts(177,17): error TS2351: Cannot use 'new' wit
|
||||
tests/cases/compiler/intTypeCheck.ts(182,5): error TS2322: Type '{}' is not assignable to type 'i7'.
|
||||
Type '{}' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(183,5): error TS2322: Type 'Object' is not assignable to type 'i7'.
|
||||
Type 'Object' provides no match for the signature 'new (): any'
|
||||
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
Type 'Object' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(185,17): error TS2352: Type 'Base' cannot be converted to type 'i7'.
|
||||
Type 'Base' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(187,5): error TS2322: Type '() => void' is not assignable to type 'i7'.
|
||||
@@ -193,7 +199,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
var obj2: i1 = new Object();
|
||||
~~~~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'i1'.
|
||||
!!! error TS2322: Property 'p' is missing in type 'Object'.
|
||||
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
!!! error TS2322: Property 'p' is missing in type 'Object'.
|
||||
var obj3: i1 = new obj0;
|
||||
~~~~~~~~
|
||||
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
@@ -229,7 +236,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
var obj13: i2 = new Object();
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'i2'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature '(): any'
|
||||
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature '(): any'
|
||||
var obj14: i2 = new obj11;
|
||||
~~~~~~~~~
|
||||
!!! error TS2350: Only a void function can be called with the 'new' keyword.
|
||||
@@ -262,7 +270,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
var obj24: i3 = new Object();
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'i3'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
|
||||
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
|
||||
var obj25: i3 = new obj22;
|
||||
var obj26: i3 = new Base;
|
||||
~~~~~
|
||||
@@ -320,7 +329,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
var obj46: i5 = new Object();
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'i5'.
|
||||
!!! error TS2322: Property 'p' is missing in type 'Object'.
|
||||
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
!!! error TS2322: Property 'p' is missing in type 'Object'.
|
||||
var obj47: i5 = new obj44;
|
||||
~~~~~~~~~
|
||||
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
@@ -356,7 +366,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
var obj57: i6 = new Object();
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'i6'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature '(): any'
|
||||
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature '(): any'
|
||||
var obj58: i6 = new obj55;
|
||||
~~~~~~~~~
|
||||
!!! error TS2350: Only a void function can be called with the 'new' keyword.
|
||||
@@ -392,7 +403,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
var obj68: i7 = new Object();
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'i7'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
|
||||
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
|
||||
var obj69: i7 = new obj66;
|
||||
var obj70: i7 = <i7>new Base;
|
||||
~~~~~~~~~~~~
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
//// [literalTypeWidening.ts]
|
||||
// Widening vs. non-widening literal types
|
||||
|
||||
function f1() {
|
||||
const c1 = "hello"; // Widening type "hello"
|
||||
let v1 = c1; // Type string
|
||||
const c2 = c1; // Widening type "hello"
|
||||
let v2 = c2; // Type string
|
||||
const c3: "hello" = "hello"; // Type "hello"
|
||||
let v3 = c3; // Type "hello"
|
||||
const c4: "hello" = c1; // Type "hello"
|
||||
let v4 = c4; // Type "hello"
|
||||
}
|
||||
|
||||
function f2(cond: boolean) {
|
||||
const c1 = cond ? "foo" : "bar"; // widening "foo" | widening "bar"
|
||||
const c2: "foo" | "bar" = c1; // "foo" | "bar"
|
||||
const c3 = cond ? c1 : c2; // "foo" | "bar"
|
||||
const c4 = cond ? c3 : "baz"; // "foo" | "bar" | widening "baz"
|
||||
const c5: "foo" | "bar" | "baz" = c4; // "foo" | "bar" | "baz"
|
||||
let v1 = c1; // string
|
||||
let v2 = c2; // "foo" | "bar"
|
||||
let v3 = c3; // "foo" | "bar"
|
||||
let v4 = c4; // string
|
||||
let v5 = c5; // "foo" | "bar" | "baz"
|
||||
}
|
||||
|
||||
function f3() {
|
||||
const c1 = 123; // Widening type 123
|
||||
let v1 = c1; // Type number
|
||||
const c2 = c1; // Widening type 123
|
||||
let v2 = c2; // Type number
|
||||
const c3: 123 = 123; // Type 123
|
||||
let v3 = c3; // Type 123
|
||||
const c4: 123 = c1; // Type 123
|
||||
let v4 = c4; // Type 123
|
||||
}
|
||||
|
||||
function f4(cond: boolean) {
|
||||
const c1 = cond ? 123 : 456; // widening 123 | widening 456
|
||||
const c2: 123 | 456 = c1; // 123 | 456
|
||||
const c3 = cond ? c1 : c2; // 123 | 456
|
||||
const c4 = cond ? c3 : 789; // 123 | 456 | widening 789
|
||||
const c5: 123 | 456 | 789 = c4; // 123 | 456 | 789
|
||||
let v1 = c1; // number
|
||||
let v2 = c2; // 123 | 456
|
||||
let v3 = c3; // 123 | 456
|
||||
let v4 = c4; // number
|
||||
let v5 = c5; // 123 | 456 | 789
|
||||
}
|
||||
|
||||
function f5() {
|
||||
const c1 = "foo";
|
||||
let v1 = c1;
|
||||
const c2: "foo" = "foo";
|
||||
let v2 = c2;
|
||||
const c3 = "foo" as "foo";
|
||||
let v3 = c3;
|
||||
const c4 = <"foo">"foo";
|
||||
let v4 = c4;
|
||||
}
|
||||
|
||||
// Repro from #10898
|
||||
|
||||
type FAILURE = "FAILURE";
|
||||
const FAILURE = "FAILURE";
|
||||
|
||||
type Result<T> = T | FAILURE;
|
||||
|
||||
function doWork<T>(): Result<T> {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
function isSuccess<T>(result: Result<T>): result is T {
|
||||
return !isFailure(result);
|
||||
}
|
||||
|
||||
function isFailure<T>(result: Result<T>): result is FAILURE {
|
||||
return result === FAILURE;
|
||||
}
|
||||
|
||||
function increment(x: number): number {
|
||||
return x + 1;
|
||||
}
|
||||
|
||||
let result = doWork<number>();
|
||||
|
||||
if (isSuccess(result)) {
|
||||
increment(result);
|
||||
}
|
||||
|
||||
// Repro from #10898
|
||||
|
||||
type TestEvent = "onmouseover" | "onmouseout";
|
||||
|
||||
function onMouseOver(): TestEvent { return "onmouseover"; }
|
||||
|
||||
let x = onMouseOver();
|
||||
|
||||
//// [literalTypeWidening.js]
|
||||
// Widening vs. non-widening literal types
|
||||
function f1() {
|
||||
var c1 = "hello"; // Widening type "hello"
|
||||
var v1 = c1; // Type string
|
||||
var c2 = c1; // Widening type "hello"
|
||||
var v2 = c2; // Type string
|
||||
var c3 = "hello"; // Type "hello"
|
||||
var v3 = c3; // Type "hello"
|
||||
var c4 = c1; // Type "hello"
|
||||
var v4 = c4; // Type "hello"
|
||||
}
|
||||
function f2(cond) {
|
||||
var c1 = cond ? "foo" : "bar"; // widening "foo" | widening "bar"
|
||||
var c2 = c1; // "foo" | "bar"
|
||||
var c3 = cond ? c1 : c2; // "foo" | "bar"
|
||||
var c4 = cond ? c3 : "baz"; // "foo" | "bar" | widening "baz"
|
||||
var c5 = c4; // "foo" | "bar" | "baz"
|
||||
var v1 = c1; // string
|
||||
var v2 = c2; // "foo" | "bar"
|
||||
var v3 = c3; // "foo" | "bar"
|
||||
var v4 = c4; // string
|
||||
var v5 = c5; // "foo" | "bar" | "baz"
|
||||
}
|
||||
function f3() {
|
||||
var c1 = 123; // Widening type 123
|
||||
var v1 = c1; // Type number
|
||||
var c2 = c1; // Widening type 123
|
||||
var v2 = c2; // Type number
|
||||
var c3 = 123; // Type 123
|
||||
var v3 = c3; // Type 123
|
||||
var c4 = c1; // Type 123
|
||||
var v4 = c4; // Type 123
|
||||
}
|
||||
function f4(cond) {
|
||||
var c1 = cond ? 123 : 456; // widening 123 | widening 456
|
||||
var c2 = c1; // 123 | 456
|
||||
var c3 = cond ? c1 : c2; // 123 | 456
|
||||
var c4 = cond ? c3 : 789; // 123 | 456 | widening 789
|
||||
var c5 = c4; // 123 | 456 | 789
|
||||
var v1 = c1; // number
|
||||
var v2 = c2; // 123 | 456
|
||||
var v3 = c3; // 123 | 456
|
||||
var v4 = c4; // number
|
||||
var v5 = c5; // 123 | 456 | 789
|
||||
}
|
||||
function f5() {
|
||||
var c1 = "foo";
|
||||
var v1 = c1;
|
||||
var c2 = "foo";
|
||||
var v2 = c2;
|
||||
var c3 = "foo";
|
||||
var v3 = c3;
|
||||
var c4 = "foo";
|
||||
var v4 = c4;
|
||||
}
|
||||
var FAILURE = "FAILURE";
|
||||
function doWork() {
|
||||
return FAILURE;
|
||||
}
|
||||
function isSuccess(result) {
|
||||
return !isFailure(result);
|
||||
}
|
||||
function isFailure(result) {
|
||||
return result === FAILURE;
|
||||
}
|
||||
function increment(x) {
|
||||
return x + 1;
|
||||
}
|
||||
var result = doWork();
|
||||
if (isSuccess(result)) {
|
||||
increment(result);
|
||||
}
|
||||
function onMouseOver() { return "onmouseover"; }
|
||||
var x = onMouseOver();
|
||||
@@ -0,0 +1,285 @@
|
||||
=== tests/cases/conformance/types/literal/literalTypeWidening.ts ===
|
||||
// Widening vs. non-widening literal types
|
||||
|
||||
function f1() {
|
||||
>f1 : Symbol(f1, Decl(literalTypeWidening.ts, 0, 0))
|
||||
|
||||
const c1 = "hello"; // Widening type "hello"
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 3, 9))
|
||||
|
||||
let v1 = c1; // Type string
|
||||
>v1 : Symbol(v1, Decl(literalTypeWidening.ts, 4, 7))
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 3, 9))
|
||||
|
||||
const c2 = c1; // Widening type "hello"
|
||||
>c2 : Symbol(c2, Decl(literalTypeWidening.ts, 5, 9))
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 3, 9))
|
||||
|
||||
let v2 = c2; // Type string
|
||||
>v2 : Symbol(v2, Decl(literalTypeWidening.ts, 6, 7))
|
||||
>c2 : Symbol(c2, Decl(literalTypeWidening.ts, 5, 9))
|
||||
|
||||
const c3: "hello" = "hello"; // Type "hello"
|
||||
>c3 : Symbol(c3, Decl(literalTypeWidening.ts, 7, 9))
|
||||
|
||||
let v3 = c3; // Type "hello"
|
||||
>v3 : Symbol(v3, Decl(literalTypeWidening.ts, 8, 7))
|
||||
>c3 : Symbol(c3, Decl(literalTypeWidening.ts, 7, 9))
|
||||
|
||||
const c4: "hello" = c1; // Type "hello"
|
||||
>c4 : Symbol(c4, Decl(literalTypeWidening.ts, 9, 9))
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 3, 9))
|
||||
|
||||
let v4 = c4; // Type "hello"
|
||||
>v4 : Symbol(v4, Decl(literalTypeWidening.ts, 10, 7))
|
||||
>c4 : Symbol(c4, Decl(literalTypeWidening.ts, 9, 9))
|
||||
}
|
||||
|
||||
function f2(cond: boolean) {
|
||||
>f2 : Symbol(f2, Decl(literalTypeWidening.ts, 11, 1))
|
||||
>cond : Symbol(cond, Decl(literalTypeWidening.ts, 13, 12))
|
||||
|
||||
const c1 = cond ? "foo" : "bar"; // widening "foo" | widening "bar"
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 14, 9))
|
||||
>cond : Symbol(cond, Decl(literalTypeWidening.ts, 13, 12))
|
||||
|
||||
const c2: "foo" | "bar" = c1; // "foo" | "bar"
|
||||
>c2 : Symbol(c2, Decl(literalTypeWidening.ts, 15, 9))
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 14, 9))
|
||||
|
||||
const c3 = cond ? c1 : c2; // "foo" | "bar"
|
||||
>c3 : Symbol(c3, Decl(literalTypeWidening.ts, 16, 9))
|
||||
>cond : Symbol(cond, Decl(literalTypeWidening.ts, 13, 12))
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 14, 9))
|
||||
>c2 : Symbol(c2, Decl(literalTypeWidening.ts, 15, 9))
|
||||
|
||||
const c4 = cond ? c3 : "baz"; // "foo" | "bar" | widening "baz"
|
||||
>c4 : Symbol(c4, Decl(literalTypeWidening.ts, 17, 9))
|
||||
>cond : Symbol(cond, Decl(literalTypeWidening.ts, 13, 12))
|
||||
>c3 : Symbol(c3, Decl(literalTypeWidening.ts, 16, 9))
|
||||
|
||||
const c5: "foo" | "bar" | "baz" = c4; // "foo" | "bar" | "baz"
|
||||
>c5 : Symbol(c5, Decl(literalTypeWidening.ts, 18, 9))
|
||||
>c4 : Symbol(c4, Decl(literalTypeWidening.ts, 17, 9))
|
||||
|
||||
let v1 = c1; // string
|
||||
>v1 : Symbol(v1, Decl(literalTypeWidening.ts, 19, 7))
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 14, 9))
|
||||
|
||||
let v2 = c2; // "foo" | "bar"
|
||||
>v2 : Symbol(v2, Decl(literalTypeWidening.ts, 20, 7))
|
||||
>c2 : Symbol(c2, Decl(literalTypeWidening.ts, 15, 9))
|
||||
|
||||
let v3 = c3; // "foo" | "bar"
|
||||
>v3 : Symbol(v3, Decl(literalTypeWidening.ts, 21, 7))
|
||||
>c3 : Symbol(c3, Decl(literalTypeWidening.ts, 16, 9))
|
||||
|
||||
let v4 = c4; // string
|
||||
>v4 : Symbol(v4, Decl(literalTypeWidening.ts, 22, 7))
|
||||
>c4 : Symbol(c4, Decl(literalTypeWidening.ts, 17, 9))
|
||||
|
||||
let v5 = c5; // "foo" | "bar" | "baz"
|
||||
>v5 : Symbol(v5, Decl(literalTypeWidening.ts, 23, 7))
|
||||
>c5 : Symbol(c5, Decl(literalTypeWidening.ts, 18, 9))
|
||||
}
|
||||
|
||||
function f3() {
|
||||
>f3 : Symbol(f3, Decl(literalTypeWidening.ts, 24, 1))
|
||||
|
||||
const c1 = 123; // Widening type 123
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 27, 9))
|
||||
|
||||
let v1 = c1; // Type number
|
||||
>v1 : Symbol(v1, Decl(literalTypeWidening.ts, 28, 7))
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 27, 9))
|
||||
|
||||
const c2 = c1; // Widening type 123
|
||||
>c2 : Symbol(c2, Decl(literalTypeWidening.ts, 29, 9))
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 27, 9))
|
||||
|
||||
let v2 = c2; // Type number
|
||||
>v2 : Symbol(v2, Decl(literalTypeWidening.ts, 30, 7))
|
||||
>c2 : Symbol(c2, Decl(literalTypeWidening.ts, 29, 9))
|
||||
|
||||
const c3: 123 = 123; // Type 123
|
||||
>c3 : Symbol(c3, Decl(literalTypeWidening.ts, 31, 9))
|
||||
|
||||
let v3 = c3; // Type 123
|
||||
>v3 : Symbol(v3, Decl(literalTypeWidening.ts, 32, 7))
|
||||
>c3 : Symbol(c3, Decl(literalTypeWidening.ts, 31, 9))
|
||||
|
||||
const c4: 123 = c1; // Type 123
|
||||
>c4 : Symbol(c4, Decl(literalTypeWidening.ts, 33, 9))
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 27, 9))
|
||||
|
||||
let v4 = c4; // Type 123
|
||||
>v4 : Symbol(v4, Decl(literalTypeWidening.ts, 34, 7))
|
||||
>c4 : Symbol(c4, Decl(literalTypeWidening.ts, 33, 9))
|
||||
}
|
||||
|
||||
function f4(cond: boolean) {
|
||||
>f4 : Symbol(f4, Decl(literalTypeWidening.ts, 35, 1))
|
||||
>cond : Symbol(cond, Decl(literalTypeWidening.ts, 37, 12))
|
||||
|
||||
const c1 = cond ? 123 : 456; // widening 123 | widening 456
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 38, 9))
|
||||
>cond : Symbol(cond, Decl(literalTypeWidening.ts, 37, 12))
|
||||
|
||||
const c2: 123 | 456 = c1; // 123 | 456
|
||||
>c2 : Symbol(c2, Decl(literalTypeWidening.ts, 39, 9))
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 38, 9))
|
||||
|
||||
const c3 = cond ? c1 : c2; // 123 | 456
|
||||
>c3 : Symbol(c3, Decl(literalTypeWidening.ts, 40, 9))
|
||||
>cond : Symbol(cond, Decl(literalTypeWidening.ts, 37, 12))
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 38, 9))
|
||||
>c2 : Symbol(c2, Decl(literalTypeWidening.ts, 39, 9))
|
||||
|
||||
const c4 = cond ? c3 : 789; // 123 | 456 | widening 789
|
||||
>c4 : Symbol(c4, Decl(literalTypeWidening.ts, 41, 9))
|
||||
>cond : Symbol(cond, Decl(literalTypeWidening.ts, 37, 12))
|
||||
>c3 : Symbol(c3, Decl(literalTypeWidening.ts, 40, 9))
|
||||
|
||||
const c5: 123 | 456 | 789 = c4; // 123 | 456 | 789
|
||||
>c5 : Symbol(c5, Decl(literalTypeWidening.ts, 42, 9))
|
||||
>c4 : Symbol(c4, Decl(literalTypeWidening.ts, 41, 9))
|
||||
|
||||
let v1 = c1; // number
|
||||
>v1 : Symbol(v1, Decl(literalTypeWidening.ts, 43, 7))
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 38, 9))
|
||||
|
||||
let v2 = c2; // 123 | 456
|
||||
>v2 : Symbol(v2, Decl(literalTypeWidening.ts, 44, 7))
|
||||
>c2 : Symbol(c2, Decl(literalTypeWidening.ts, 39, 9))
|
||||
|
||||
let v3 = c3; // 123 | 456
|
||||
>v3 : Symbol(v3, Decl(literalTypeWidening.ts, 45, 7))
|
||||
>c3 : Symbol(c3, Decl(literalTypeWidening.ts, 40, 9))
|
||||
|
||||
let v4 = c4; // number
|
||||
>v4 : Symbol(v4, Decl(literalTypeWidening.ts, 46, 7))
|
||||
>c4 : Symbol(c4, Decl(literalTypeWidening.ts, 41, 9))
|
||||
|
||||
let v5 = c5; // 123 | 456 | 789
|
||||
>v5 : Symbol(v5, Decl(literalTypeWidening.ts, 47, 7))
|
||||
>c5 : Symbol(c5, Decl(literalTypeWidening.ts, 42, 9))
|
||||
}
|
||||
|
||||
function f5() {
|
||||
>f5 : Symbol(f5, Decl(literalTypeWidening.ts, 48, 1))
|
||||
|
||||
const c1 = "foo";
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 51, 9))
|
||||
|
||||
let v1 = c1;
|
||||
>v1 : Symbol(v1, Decl(literalTypeWidening.ts, 52, 7))
|
||||
>c1 : Symbol(c1, Decl(literalTypeWidening.ts, 51, 9))
|
||||
|
||||
const c2: "foo" = "foo";
|
||||
>c2 : Symbol(c2, Decl(literalTypeWidening.ts, 53, 9))
|
||||
|
||||
let v2 = c2;
|
||||
>v2 : Symbol(v2, Decl(literalTypeWidening.ts, 54, 7))
|
||||
>c2 : Symbol(c2, Decl(literalTypeWidening.ts, 53, 9))
|
||||
|
||||
const c3 = "foo" as "foo";
|
||||
>c3 : Symbol(c3, Decl(literalTypeWidening.ts, 55, 9))
|
||||
|
||||
let v3 = c3;
|
||||
>v3 : Symbol(v3, Decl(literalTypeWidening.ts, 56, 7))
|
||||
>c3 : Symbol(c3, Decl(literalTypeWidening.ts, 55, 9))
|
||||
|
||||
const c4 = <"foo">"foo";
|
||||
>c4 : Symbol(c4, Decl(literalTypeWidening.ts, 57, 9))
|
||||
|
||||
let v4 = c4;
|
||||
>v4 : Symbol(v4, Decl(literalTypeWidening.ts, 58, 7))
|
||||
>c4 : Symbol(c4, Decl(literalTypeWidening.ts, 57, 9))
|
||||
}
|
||||
|
||||
// Repro from #10898
|
||||
|
||||
type FAILURE = "FAILURE";
|
||||
>FAILURE : Symbol(FAILURE, Decl(literalTypeWidening.ts, 59, 1), Decl(literalTypeWidening.ts, 64, 5))
|
||||
|
||||
const FAILURE = "FAILURE";
|
||||
>FAILURE : Symbol(FAILURE, Decl(literalTypeWidening.ts, 59, 1), Decl(literalTypeWidening.ts, 64, 5))
|
||||
|
||||
type Result<T> = T | FAILURE;
|
||||
>Result : Symbol(Result, Decl(literalTypeWidening.ts, 64, 26))
|
||||
>T : Symbol(T, Decl(literalTypeWidening.ts, 66, 12))
|
||||
>T : Symbol(T, Decl(literalTypeWidening.ts, 66, 12))
|
||||
>FAILURE : Symbol(FAILURE, Decl(literalTypeWidening.ts, 59, 1), Decl(literalTypeWidening.ts, 64, 5))
|
||||
|
||||
function doWork<T>(): Result<T> {
|
||||
>doWork : Symbol(doWork, Decl(literalTypeWidening.ts, 66, 29))
|
||||
>T : Symbol(T, Decl(literalTypeWidening.ts, 68, 16))
|
||||
>Result : Symbol(Result, Decl(literalTypeWidening.ts, 64, 26))
|
||||
>T : Symbol(T, Decl(literalTypeWidening.ts, 68, 16))
|
||||
|
||||
return FAILURE;
|
||||
>FAILURE : Symbol(FAILURE, Decl(literalTypeWidening.ts, 59, 1), Decl(literalTypeWidening.ts, 64, 5))
|
||||
}
|
||||
|
||||
function isSuccess<T>(result: Result<T>): result is T {
|
||||
>isSuccess : Symbol(isSuccess, Decl(literalTypeWidening.ts, 70, 1))
|
||||
>T : Symbol(T, Decl(literalTypeWidening.ts, 72, 19))
|
||||
>result : Symbol(result, Decl(literalTypeWidening.ts, 72, 22))
|
||||
>Result : Symbol(Result, Decl(literalTypeWidening.ts, 64, 26))
|
||||
>T : Symbol(T, Decl(literalTypeWidening.ts, 72, 19))
|
||||
>result : Symbol(result, Decl(literalTypeWidening.ts, 72, 22))
|
||||
>T : Symbol(T, Decl(literalTypeWidening.ts, 72, 19))
|
||||
|
||||
return !isFailure(result);
|
||||
>isFailure : Symbol(isFailure, Decl(literalTypeWidening.ts, 74, 1))
|
||||
>result : Symbol(result, Decl(literalTypeWidening.ts, 72, 22))
|
||||
}
|
||||
|
||||
function isFailure<T>(result: Result<T>): result is FAILURE {
|
||||
>isFailure : Symbol(isFailure, Decl(literalTypeWidening.ts, 74, 1))
|
||||
>T : Symbol(T, Decl(literalTypeWidening.ts, 76, 19))
|
||||
>result : Symbol(result, Decl(literalTypeWidening.ts, 76, 22))
|
||||
>Result : Symbol(Result, Decl(literalTypeWidening.ts, 64, 26))
|
||||
>T : Symbol(T, Decl(literalTypeWidening.ts, 76, 19))
|
||||
>result : Symbol(result, Decl(literalTypeWidening.ts, 76, 22))
|
||||
>FAILURE : Symbol(FAILURE, Decl(literalTypeWidening.ts, 59, 1), Decl(literalTypeWidening.ts, 64, 5))
|
||||
|
||||
return result === FAILURE;
|
||||
>result : Symbol(result, Decl(literalTypeWidening.ts, 76, 22))
|
||||
>FAILURE : Symbol(FAILURE, Decl(literalTypeWidening.ts, 59, 1), Decl(literalTypeWidening.ts, 64, 5))
|
||||
}
|
||||
|
||||
function increment(x: number): number {
|
||||
>increment : Symbol(increment, Decl(literalTypeWidening.ts, 78, 1))
|
||||
>x : Symbol(x, Decl(literalTypeWidening.ts, 80, 19))
|
||||
|
||||
return x + 1;
|
||||
>x : Symbol(x, Decl(literalTypeWidening.ts, 80, 19))
|
||||
}
|
||||
|
||||
let result = doWork<number>();
|
||||
>result : Symbol(result, Decl(literalTypeWidening.ts, 84, 3))
|
||||
>doWork : Symbol(doWork, Decl(literalTypeWidening.ts, 66, 29))
|
||||
|
||||
if (isSuccess(result)) {
|
||||
>isSuccess : Symbol(isSuccess, Decl(literalTypeWidening.ts, 70, 1))
|
||||
>result : Symbol(result, Decl(literalTypeWidening.ts, 84, 3))
|
||||
|
||||
increment(result);
|
||||
>increment : Symbol(increment, Decl(literalTypeWidening.ts, 78, 1))
|
||||
>result : Symbol(result, Decl(literalTypeWidening.ts, 84, 3))
|
||||
}
|
||||
|
||||
// Repro from #10898
|
||||
|
||||
type TestEvent = "onmouseover" | "onmouseout";
|
||||
>TestEvent : Symbol(TestEvent, Decl(literalTypeWidening.ts, 88, 1))
|
||||
|
||||
function onMouseOver(): TestEvent { return "onmouseover"; }
|
||||
>onMouseOver : Symbol(onMouseOver, Decl(literalTypeWidening.ts, 92, 46))
|
||||
>TestEvent : Symbol(TestEvent, Decl(literalTypeWidening.ts, 88, 1))
|
||||
|
||||
let x = onMouseOver();
|
||||
>x : Symbol(x, Decl(literalTypeWidening.ts, 96, 3))
|
||||
>onMouseOver : Symbol(onMouseOver, Decl(literalTypeWidening.ts, 92, 46))
|
||||
|
||||
@@ -0,0 +1,318 @@
|
||||
=== tests/cases/conformance/types/literal/literalTypeWidening.ts ===
|
||||
// Widening vs. non-widening literal types
|
||||
|
||||
function f1() {
|
||||
>f1 : () => void
|
||||
|
||||
const c1 = "hello"; // Widening type "hello"
|
||||
>c1 : "hello"
|
||||
>"hello" : "hello"
|
||||
|
||||
let v1 = c1; // Type string
|
||||
>v1 : string
|
||||
>c1 : "hello"
|
||||
|
||||
const c2 = c1; // Widening type "hello"
|
||||
>c2 : "hello"
|
||||
>c1 : "hello"
|
||||
|
||||
let v2 = c2; // Type string
|
||||
>v2 : string
|
||||
>c2 : "hello"
|
||||
|
||||
const c3: "hello" = "hello"; // Type "hello"
|
||||
>c3 : "hello"
|
||||
>"hello" : "hello"
|
||||
|
||||
let v3 = c3; // Type "hello"
|
||||
>v3 : "hello"
|
||||
>c3 : "hello"
|
||||
|
||||
const c4: "hello" = c1; // Type "hello"
|
||||
>c4 : "hello"
|
||||
>c1 : "hello"
|
||||
|
||||
let v4 = c4; // Type "hello"
|
||||
>v4 : "hello"
|
||||
>c4 : "hello"
|
||||
}
|
||||
|
||||
function f2(cond: boolean) {
|
||||
>f2 : (cond: boolean) => void
|
||||
>cond : boolean
|
||||
|
||||
const c1 = cond ? "foo" : "bar"; // widening "foo" | widening "bar"
|
||||
>c1 : "foo" | "bar"
|
||||
>cond ? "foo" : "bar" : "foo" | "bar"
|
||||
>cond : boolean
|
||||
>"foo" : "foo"
|
||||
>"bar" : "bar"
|
||||
|
||||
const c2: "foo" | "bar" = c1; // "foo" | "bar"
|
||||
>c2 : "foo" | "bar"
|
||||
>c1 : "foo" | "bar"
|
||||
|
||||
const c3 = cond ? c1 : c2; // "foo" | "bar"
|
||||
>c3 : "foo" | "bar"
|
||||
>cond ? c1 : c2 : "foo" | "bar"
|
||||
>cond : boolean
|
||||
>c1 : "foo" | "bar"
|
||||
>c2 : "foo" | "bar"
|
||||
|
||||
const c4 = cond ? c3 : "baz"; // "foo" | "bar" | widening "baz"
|
||||
>c4 : "foo" | "bar" | "baz"
|
||||
>cond ? c3 : "baz" : "foo" | "bar" | "baz"
|
||||
>cond : boolean
|
||||
>c3 : "foo" | "bar"
|
||||
>"baz" : "baz"
|
||||
|
||||
const c5: "foo" | "bar" | "baz" = c4; // "foo" | "bar" | "baz"
|
||||
>c5 : "foo" | "bar" | "baz"
|
||||
>c4 : "foo" | "bar" | "baz"
|
||||
|
||||
let v1 = c1; // string
|
||||
>v1 : string
|
||||
>c1 : "foo" | "bar"
|
||||
|
||||
let v2 = c2; // "foo" | "bar"
|
||||
>v2 : "foo" | "bar"
|
||||
>c2 : "foo" | "bar"
|
||||
|
||||
let v3 = c3; // "foo" | "bar"
|
||||
>v3 : "foo" | "bar"
|
||||
>c3 : "foo" | "bar"
|
||||
|
||||
let v4 = c4; // string
|
||||
>v4 : string
|
||||
>c4 : "foo" | "bar" | "baz"
|
||||
|
||||
let v5 = c5; // "foo" | "bar" | "baz"
|
||||
>v5 : "foo" | "bar" | "baz"
|
||||
>c5 : "foo" | "bar" | "baz"
|
||||
}
|
||||
|
||||
function f3() {
|
||||
>f3 : () => void
|
||||
|
||||
const c1 = 123; // Widening type 123
|
||||
>c1 : 123
|
||||
>123 : 123
|
||||
|
||||
let v1 = c1; // Type number
|
||||
>v1 : number
|
||||
>c1 : 123
|
||||
|
||||
const c2 = c1; // Widening type 123
|
||||
>c2 : 123
|
||||
>c1 : 123
|
||||
|
||||
let v2 = c2; // Type number
|
||||
>v2 : number
|
||||
>c2 : 123
|
||||
|
||||
const c3: 123 = 123; // Type 123
|
||||
>c3 : 123
|
||||
>123 : 123
|
||||
|
||||
let v3 = c3; // Type 123
|
||||
>v3 : 123
|
||||
>c3 : 123
|
||||
|
||||
const c4: 123 = c1; // Type 123
|
||||
>c4 : 123
|
||||
>c1 : 123
|
||||
|
||||
let v4 = c4; // Type 123
|
||||
>v4 : 123
|
||||
>c4 : 123
|
||||
}
|
||||
|
||||
function f4(cond: boolean) {
|
||||
>f4 : (cond: boolean) => void
|
||||
>cond : boolean
|
||||
|
||||
const c1 = cond ? 123 : 456; // widening 123 | widening 456
|
||||
>c1 : 123 | 456
|
||||
>cond ? 123 : 456 : 123 | 456
|
||||
>cond : boolean
|
||||
>123 : 123
|
||||
>456 : 456
|
||||
|
||||
const c2: 123 | 456 = c1; // 123 | 456
|
||||
>c2 : 123 | 456
|
||||
>c1 : 123 | 456
|
||||
|
||||
const c3 = cond ? c1 : c2; // 123 | 456
|
||||
>c3 : 123 | 456
|
||||
>cond ? c1 : c2 : 123 | 456
|
||||
>cond : boolean
|
||||
>c1 : 123 | 456
|
||||
>c2 : 123 | 456
|
||||
|
||||
const c4 = cond ? c3 : 789; // 123 | 456 | widening 789
|
||||
>c4 : 123 | 456 | 789
|
||||
>cond ? c3 : 789 : 123 | 456 | 789
|
||||
>cond : boolean
|
||||
>c3 : 123 | 456
|
||||
>789 : 789
|
||||
|
||||
const c5: 123 | 456 | 789 = c4; // 123 | 456 | 789
|
||||
>c5 : 123 | 456 | 789
|
||||
>c4 : 123 | 456 | 789
|
||||
|
||||
let v1 = c1; // number
|
||||
>v1 : number
|
||||
>c1 : 123 | 456
|
||||
|
||||
let v2 = c2; // 123 | 456
|
||||
>v2 : 123 | 456
|
||||
>c2 : 123 | 456
|
||||
|
||||
let v3 = c3; // 123 | 456
|
||||
>v3 : 123 | 456
|
||||
>c3 : 123 | 456
|
||||
|
||||
let v4 = c4; // number
|
||||
>v4 : number
|
||||
>c4 : 123 | 456 | 789
|
||||
|
||||
let v5 = c5; // 123 | 456 | 789
|
||||
>v5 : 123 | 456 | 789
|
||||
>c5 : 123 | 456 | 789
|
||||
}
|
||||
|
||||
function f5() {
|
||||
>f5 : () => void
|
||||
|
||||
const c1 = "foo";
|
||||
>c1 : "foo"
|
||||
>"foo" : "foo"
|
||||
|
||||
let v1 = c1;
|
||||
>v1 : string
|
||||
>c1 : "foo"
|
||||
|
||||
const c2: "foo" = "foo";
|
||||
>c2 : "foo"
|
||||
>"foo" : "foo"
|
||||
|
||||
let v2 = c2;
|
||||
>v2 : "foo"
|
||||
>c2 : "foo"
|
||||
|
||||
const c3 = "foo" as "foo";
|
||||
>c3 : "foo"
|
||||
>"foo" as "foo" : "foo"
|
||||
>"foo" : "foo"
|
||||
|
||||
let v3 = c3;
|
||||
>v3 : "foo"
|
||||
>c3 : "foo"
|
||||
|
||||
const c4 = <"foo">"foo";
|
||||
>c4 : "foo"
|
||||
><"foo">"foo" : "foo"
|
||||
>"foo" : "foo"
|
||||
|
||||
let v4 = c4;
|
||||
>v4 : "foo"
|
||||
>c4 : "foo"
|
||||
}
|
||||
|
||||
// Repro from #10898
|
||||
|
||||
type FAILURE = "FAILURE";
|
||||
>FAILURE : "FAILURE"
|
||||
|
||||
const FAILURE = "FAILURE";
|
||||
>FAILURE : "FAILURE"
|
||||
>"FAILURE" : "FAILURE"
|
||||
|
||||
type Result<T> = T | FAILURE;
|
||||
>Result : Result<T>
|
||||
>T : T
|
||||
>T : T
|
||||
>FAILURE : "FAILURE"
|
||||
|
||||
function doWork<T>(): Result<T> {
|
||||
>doWork : <T>() => Result<T>
|
||||
>T : T
|
||||
>Result : Result<T>
|
||||
>T : T
|
||||
|
||||
return FAILURE;
|
||||
>FAILURE : "FAILURE"
|
||||
}
|
||||
|
||||
function isSuccess<T>(result: Result<T>): result is T {
|
||||
>isSuccess : <T>(result: Result<T>) => result is T
|
||||
>T : T
|
||||
>result : Result<T>
|
||||
>Result : Result<T>
|
||||
>T : T
|
||||
>result : any
|
||||
>T : T
|
||||
|
||||
return !isFailure(result);
|
||||
>!isFailure(result) : boolean
|
||||
>isFailure(result) : boolean
|
||||
>isFailure : <T>(result: Result<T>) => result is "FAILURE"
|
||||
>result : Result<T>
|
||||
}
|
||||
|
||||
function isFailure<T>(result: Result<T>): result is FAILURE {
|
||||
>isFailure : <T>(result: Result<T>) => result is "FAILURE"
|
||||
>T : T
|
||||
>result : Result<T>
|
||||
>Result : Result<T>
|
||||
>T : T
|
||||
>result : any
|
||||
>FAILURE : "FAILURE"
|
||||
|
||||
return result === FAILURE;
|
||||
>result === FAILURE : boolean
|
||||
>result : Result<T>
|
||||
>FAILURE : "FAILURE"
|
||||
}
|
||||
|
||||
function increment(x: number): number {
|
||||
>increment : (x: number) => number
|
||||
>x : number
|
||||
|
||||
return x + 1;
|
||||
>x + 1 : number
|
||||
>x : number
|
||||
>1 : 1
|
||||
}
|
||||
|
||||
let result = doWork<number>();
|
||||
>result : Result<number>
|
||||
>doWork<number>() : Result<number>
|
||||
>doWork : <T>() => Result<T>
|
||||
|
||||
if (isSuccess(result)) {
|
||||
>isSuccess(result) : boolean
|
||||
>isSuccess : <T>(result: Result<T>) => result is T
|
||||
>result : Result<number>
|
||||
|
||||
increment(result);
|
||||
>increment(result) : number
|
||||
>increment : (x: number) => number
|
||||
>result : number
|
||||
}
|
||||
|
||||
// Repro from #10898
|
||||
|
||||
type TestEvent = "onmouseover" | "onmouseout";
|
||||
>TestEvent : TestEvent
|
||||
|
||||
function onMouseOver(): TestEvent { return "onmouseover"; }
|
||||
>onMouseOver : () => TestEvent
|
||||
>TestEvent : TestEvent
|
||||
>"onmouseover" : "onmouseover"
|
||||
|
||||
let x = onMouseOver();
|
||||
>x : TestEvent
|
||||
>onMouseOver() : TestEvent
|
||||
>onMouseOver : () => TestEvent
|
||||
|
||||
@@ -482,7 +482,7 @@ function f6() {
|
||||
const { c1 = true, c2 = 0, c3 = "foo" } = { c1: false, c2: 1, c3: "bar" };
|
||||
>c1 : boolean
|
||||
>true : true
|
||||
>c2 : 0 | 1
|
||||
>c2 : 1 | 0
|
||||
>0 : 0
|
||||
>c3 : "foo" | "bar"
|
||||
>"foo" : "foo"
|
||||
@@ -552,10 +552,10 @@ class C2 {
|
||||
>0 : 0
|
||||
}
|
||||
bar() {
|
||||
>bar : () => 0 | 1
|
||||
>bar : () => 1 | 0
|
||||
|
||||
return cond ? 0 : 1;
|
||||
>cond ? 0 : 1 : 0 | 1
|
||||
>cond ? 0 : 1 : 1 | 0
|
||||
>cond : boolean
|
||||
>0 : 0
|
||||
>1 : 1
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [modularizeLibrary_Dom.iterable.ts]
|
||||
|
||||
for (const element of document.getElementsByTagName("a")) {
|
||||
element.href;
|
||||
}
|
||||
|
||||
//// [modularizeLibrary_Dom.iterable.js]
|
||||
for (const element of document.getElementsByTagName("a")) {
|
||||
element.href;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -45,7 +45,7 @@
|
||||
return C;
|
||||
}());
|
||||
export default C;
|
||||
function bee() { }
|
||||
export function bee() { }
|
||||
import I2 = require("foo");
|
||||
import * as Foo from "ambient";
|
||||
import bar from "ambient";
|
||||
|
||||
@@ -45,7 +45,7 @@ function blah() {
|
||||
return C;
|
||||
}());
|
||||
export default C;
|
||||
function bee() { }
|
||||
export function bee() { }
|
||||
import I2 = require("foo");
|
||||
import * as Foo from "ambient";
|
||||
import bar from "ambient";
|
||||
|
||||
@@ -370,7 +370,7 @@ function f14(x: 0 | 1 | 2, y: string) {
|
||||
>y : string
|
||||
|
||||
var b = x || y;
|
||||
>b : string | number
|
||||
>b : string | 1 | 2
|
||||
>x || y : string | 1 | 2
|
||||
>x : 0 | 1 | 2
|
||||
>y : string
|
||||
@@ -383,25 +383,25 @@ function f15(x: 0 | false, y: 1 | "one") {
|
||||
>y : 1 | "one"
|
||||
|
||||
var a = x && y;
|
||||
>a : number | boolean
|
||||
>a : boolean | 0
|
||||
>x && y : false | 0
|
||||
>x : false | 0
|
||||
>y : 1 | "one"
|
||||
|
||||
var b = y && x;
|
||||
>b : number | boolean
|
||||
>b : boolean | 0
|
||||
>y && x : false | 0
|
||||
>y : 1 | "one"
|
||||
>x : false | 0
|
||||
|
||||
var c = x || y;
|
||||
>c : string | number
|
||||
>c : 1 | "one"
|
||||
>x || y : 1 | "one"
|
||||
>x : false | 0
|
||||
>y : 1 | "one"
|
||||
|
||||
var d = y || x;
|
||||
>d : string | number | boolean
|
||||
>d : boolean | 0 | 1 | "one"
|
||||
>y || x : false | 0 | 1 | "one"
|
||||
>y : 1 | "one"
|
||||
>x : false | 0
|
||||
|
||||
@@ -365,13 +365,13 @@ function f14(x: 0 | 1 | 2, y: string) {
|
||||
>y : string
|
||||
|
||||
var a = x && y;
|
||||
>a : string | number
|
||||
>a : string | 0
|
||||
>x && y : string | 0
|
||||
>x : 0 | 1 | 2
|
||||
>y : string
|
||||
|
||||
var b = x || y;
|
||||
>b : string | number
|
||||
>b : string | 1 | 2
|
||||
>x || y : string | 1 | 2
|
||||
>x : 0 | 1 | 2
|
||||
>y : string
|
||||
@@ -384,25 +384,25 @@ function f15(x: 0 | false, y: 1 | "one") {
|
||||
>y : 1 | "one"
|
||||
|
||||
var a = x && y;
|
||||
>a : number | boolean
|
||||
>a : boolean | 0
|
||||
>x && y : false | 0
|
||||
>x : false | 0
|
||||
>y : 1 | "one"
|
||||
|
||||
var b = y && x;
|
||||
>b : number | boolean
|
||||
>b : boolean | 0
|
||||
>y && x : false | 0
|
||||
>y : 1 | "one"
|
||||
>x : false | 0
|
||||
|
||||
var c = x || y;
|
||||
>c : string | number
|
||||
>c : 1 | "one"
|
||||
>x || y : 1 | "one"
|
||||
>x : false | 0
|
||||
>y : 1 | "one"
|
||||
|
||||
var d = y || x;
|
||||
>d : string | number
|
||||
>d : 1 | "one"
|
||||
>y || x : 1 | "one"
|
||||
>y : 1 | "one"
|
||||
>x : false | 0
|
||||
|
||||
+16
-12
@@ -3,17 +3,19 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC
|
||||
Type '() => number' is not assignable to type '() => string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'.
|
||||
Types of property 'toString' are incompatible.
|
||||
Type '() => string' is not assignable to type '() => number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
Types of property 'toString' are incompatible.
|
||||
Type '() => string' is not assignable to type '() => number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(14,1): error TS2322: Type 'C' is not assignable to type 'Object'.
|
||||
Types of property 'toString' are incompatible.
|
||||
Type '() => number' is not assignable to type '() => string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(15,1): error TS2322: Type 'Object' is not assignable to type 'C'.
|
||||
Types of property 'toString' are incompatible.
|
||||
Type '() => string' is not assignable to type '() => number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
Types of property 'toString' are incompatible.
|
||||
Type '() => string' is not assignable to type '() => number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(20,1): error TS2322: Type '{ toString: () => void; }' is not assignable to type 'Object'.
|
||||
Types of property 'toString' are incompatible.
|
||||
Type '() => void' is not assignable to type '() => string'.
|
||||
@@ -36,9 +38,10 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC
|
||||
i = o; // error
|
||||
~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'I'.
|
||||
!!! error TS2322: Types of property 'toString' are incompatible.
|
||||
!!! error TS2322: Type '() => string' is not assignable to type '() => number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
!!! error TS2322: Types of property 'toString' are incompatible.
|
||||
!!! error TS2322: Type '() => string' is not assignable to type '() => number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
class C {
|
||||
toString(): number { return 1; }
|
||||
@@ -53,9 +56,10 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC
|
||||
c = o; // error
|
||||
~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'C'.
|
||||
!!! error TS2322: Types of property 'toString' are incompatible.
|
||||
!!! error TS2322: Type '() => string' is not assignable to type '() => number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
!!! error TS2322: Types of property 'toString' are incompatible.
|
||||
!!! error TS2322: Type '() => string' is not assignable to type '() => number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
var a = {
|
||||
toString: () => { }
|
||||
|
||||
+8
-4
@@ -1,7 +1,9 @@
|
||||
tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'.
|
||||
Type 'Object' provides no match for the signature '(): void'
|
||||
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
Type 'Object' provides no match for the signature '(): void'
|
||||
tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts(14,1): error TS2322: Type 'Object' is not assignable to type '() => void'.
|
||||
Type 'Object' provides no match for the signature '(): void'
|
||||
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
Type 'Object' provides no match for the signature '(): void'
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts (2 errors) ====
|
||||
@@ -15,7 +17,8 @@ tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOf
|
||||
i = f;
|
||||
~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'I'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature '(): void'
|
||||
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature '(): void'
|
||||
|
||||
var a: {
|
||||
(): void
|
||||
@@ -24,4 +27,5 @@ tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOf
|
||||
a = f;
|
||||
~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type '() => void'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature '(): void'
|
||||
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature '(): void'
|
||||
+8
-4
@@ -1,7 +1,9 @@
|
||||
tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'.
|
||||
Type 'Object' provides no match for the signature 'new (): any'
|
||||
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
Type 'Object' provides no match for the signature 'new (): any'
|
||||
tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts(14,1): error TS2322: Type 'Object' is not assignable to type 'new () => any'.
|
||||
Type 'Object' provides no match for the signature 'new (): any'
|
||||
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
Type 'Object' provides no match for the signature 'new (): any'
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts (2 errors) ====
|
||||
@@ -15,7 +17,8 @@ tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMemb
|
||||
i = f;
|
||||
~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'I'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
|
||||
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
|
||||
|
||||
var a: {
|
||||
new(): any
|
||||
@@ -24,4 +27,5 @@ tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMemb
|
||||
a = f;
|
||||
~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'new () => any'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
|
||||
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
|
||||
@@ -1,7 +1,9 @@
|
||||
tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAutomaticSemicolonInsertion1.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'.
|
||||
Type 'Object' provides no match for the signature '(): void'
|
||||
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
Type 'Object' provides no match for the signature '(): void'
|
||||
tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAutomaticSemicolonInsertion1.ts(14,1): error TS2322: Type 'Object' is not assignable to type '() => void'.
|
||||
Type 'Object' provides no match for the signature '(): void'
|
||||
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
Type 'Object' provides no match for the signature '(): void'
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAutomaticSemicolonInsertion1.ts (2 errors) ====
|
||||
@@ -15,7 +17,8 @@ tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAut
|
||||
i = o;
|
||||
~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'I'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature '(): void'
|
||||
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature '(): void'
|
||||
|
||||
var a: {
|
||||
(): void
|
||||
@@ -24,5 +27,6 @@ tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAut
|
||||
a = o;
|
||||
~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type '() => void'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature '(): void'
|
||||
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature '(): void'
|
||||
|
||||
@@ -8,7 +8,7 @@ export function foo() {
|
||||
//// [parserModifierOnStatementInBlock3.js]
|
||||
"use strict";
|
||||
function foo() {
|
||||
function bar() {
|
||||
export function bar() {
|
||||
}
|
||||
}
|
||||
exports.foo = foo;
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
|
||||
//// [parserModifierOnStatementInBlock4.js]
|
||||
{
|
||||
function bar() {
|
||||
export function bar() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
//// [partiallyDiscriminantedUnions.ts]
|
||||
// Repro from #10586
|
||||
|
||||
interface A1 {
|
||||
type: 'a';
|
||||
subtype: 1;
|
||||
}
|
||||
|
||||
interface A2 {
|
||||
type: 'a';
|
||||
subtype: 2;
|
||||
foo: number;
|
||||
}
|
||||
|
||||
interface B {
|
||||
type: 'b';
|
||||
}
|
||||
|
||||
type AB = A1 | A2 | B;
|
||||
|
||||
const ab: AB = <AB>{};
|
||||
|
||||
if (ab.type === 'a') {
|
||||
if (ab.subtype === 2) {
|
||||
ab.foo;
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #11185
|
||||
|
||||
class Square { kind: "square"; }
|
||||
class Circle { kind: "circle"; }
|
||||
|
||||
type Shape = Circle | Square;
|
||||
type Shapes = Shape | Array<Shape>;
|
||||
|
||||
function isShape(s : Shapes): s is Shape {
|
||||
return !Array.isArray(s);
|
||||
}
|
||||
|
||||
function fail(s: Shapes) {
|
||||
if (isShape(s)) {
|
||||
if (s.kind === "circle") {
|
||||
let c: Circle = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//// [partiallyDiscriminantedUnions.js]
|
||||
// Repro from #10586
|
||||
var ab = {};
|
||||
if (ab.type === 'a') {
|
||||
if (ab.subtype === 2) {
|
||||
ab.foo;
|
||||
}
|
||||
}
|
||||
// Repro from #11185
|
||||
var Square = (function () {
|
||||
function Square() {
|
||||
}
|
||||
return Square;
|
||||
}());
|
||||
var Circle = (function () {
|
||||
function Circle() {
|
||||
}
|
||||
return Circle;
|
||||
}());
|
||||
function isShape(s) {
|
||||
return !Array.isArray(s);
|
||||
}
|
||||
function fail(s) {
|
||||
if (isShape(s)) {
|
||||
if (s.kind === "circle") {
|
||||
var c = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
=== tests/cases/compiler/partiallyDiscriminantedUnions.ts ===
|
||||
// Repro from #10586
|
||||
|
||||
interface A1 {
|
||||
>A1 : Symbol(A1, Decl(partiallyDiscriminantedUnions.ts, 0, 0))
|
||||
|
||||
type: 'a';
|
||||
>type : Symbol(A1.type, Decl(partiallyDiscriminantedUnions.ts, 2, 14))
|
||||
|
||||
subtype: 1;
|
||||
>subtype : Symbol(A1.subtype, Decl(partiallyDiscriminantedUnions.ts, 3, 14))
|
||||
}
|
||||
|
||||
interface A2 {
|
||||
>A2 : Symbol(A2, Decl(partiallyDiscriminantedUnions.ts, 5, 1))
|
||||
|
||||
type: 'a';
|
||||
>type : Symbol(A2.type, Decl(partiallyDiscriminantedUnions.ts, 7, 14))
|
||||
|
||||
subtype: 2;
|
||||
>subtype : Symbol(A2.subtype, Decl(partiallyDiscriminantedUnions.ts, 8, 14))
|
||||
|
||||
foo: number;
|
||||
>foo : Symbol(A2.foo, Decl(partiallyDiscriminantedUnions.ts, 9, 15))
|
||||
}
|
||||
|
||||
interface B {
|
||||
>B : Symbol(B, Decl(partiallyDiscriminantedUnions.ts, 11, 1))
|
||||
|
||||
type: 'b';
|
||||
>type : Symbol(B.type, Decl(partiallyDiscriminantedUnions.ts, 13, 13))
|
||||
}
|
||||
|
||||
type AB = A1 | A2 | B;
|
||||
>AB : Symbol(AB, Decl(partiallyDiscriminantedUnions.ts, 15, 1))
|
||||
>A1 : Symbol(A1, Decl(partiallyDiscriminantedUnions.ts, 0, 0))
|
||||
>A2 : Symbol(A2, Decl(partiallyDiscriminantedUnions.ts, 5, 1))
|
||||
>B : Symbol(B, Decl(partiallyDiscriminantedUnions.ts, 11, 1))
|
||||
|
||||
const ab: AB = <AB>{};
|
||||
>ab : Symbol(ab, Decl(partiallyDiscriminantedUnions.ts, 19, 5))
|
||||
>AB : Symbol(AB, Decl(partiallyDiscriminantedUnions.ts, 15, 1))
|
||||
>AB : Symbol(AB, Decl(partiallyDiscriminantedUnions.ts, 15, 1))
|
||||
|
||||
if (ab.type === 'a') {
|
||||
>ab.type : Symbol(type, Decl(partiallyDiscriminantedUnions.ts, 2, 14), Decl(partiallyDiscriminantedUnions.ts, 7, 14), Decl(partiallyDiscriminantedUnions.ts, 13, 13))
|
||||
>ab : Symbol(ab, Decl(partiallyDiscriminantedUnions.ts, 19, 5))
|
||||
>type : Symbol(type, Decl(partiallyDiscriminantedUnions.ts, 2, 14), Decl(partiallyDiscriminantedUnions.ts, 7, 14), Decl(partiallyDiscriminantedUnions.ts, 13, 13))
|
||||
|
||||
if (ab.subtype === 2) {
|
||||
>ab.subtype : Symbol(subtype, Decl(partiallyDiscriminantedUnions.ts, 3, 14), Decl(partiallyDiscriminantedUnions.ts, 8, 14))
|
||||
>ab : Symbol(ab, Decl(partiallyDiscriminantedUnions.ts, 19, 5))
|
||||
>subtype : Symbol(subtype, Decl(partiallyDiscriminantedUnions.ts, 3, 14), Decl(partiallyDiscriminantedUnions.ts, 8, 14))
|
||||
|
||||
ab.foo;
|
||||
>ab.foo : Symbol(A2.foo, Decl(partiallyDiscriminantedUnions.ts, 9, 15))
|
||||
>ab : Symbol(ab, Decl(partiallyDiscriminantedUnions.ts, 19, 5))
|
||||
>foo : Symbol(A2.foo, Decl(partiallyDiscriminantedUnions.ts, 9, 15))
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #11185
|
||||
|
||||
class Square { kind: "square"; }
|
||||
>Square : Symbol(Square, Decl(partiallyDiscriminantedUnions.ts, 25, 1))
|
||||
>kind : Symbol(Square.kind, Decl(partiallyDiscriminantedUnions.ts, 29, 14))
|
||||
|
||||
class Circle { kind: "circle"; }
|
||||
>Circle : Symbol(Circle, Decl(partiallyDiscriminantedUnions.ts, 29, 32))
|
||||
>kind : Symbol(Circle.kind, Decl(partiallyDiscriminantedUnions.ts, 30, 14))
|
||||
|
||||
type Shape = Circle | Square;
|
||||
>Shape : Symbol(Shape, Decl(partiallyDiscriminantedUnions.ts, 30, 32))
|
||||
>Circle : Symbol(Circle, Decl(partiallyDiscriminantedUnions.ts, 29, 32))
|
||||
>Square : Symbol(Square, Decl(partiallyDiscriminantedUnions.ts, 25, 1))
|
||||
|
||||
type Shapes = Shape | Array<Shape>;
|
||||
>Shapes : Symbol(Shapes, Decl(partiallyDiscriminantedUnions.ts, 32, 29))
|
||||
>Shape : Symbol(Shape, Decl(partiallyDiscriminantedUnions.ts, 30, 32))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>Shape : Symbol(Shape, Decl(partiallyDiscriminantedUnions.ts, 30, 32))
|
||||
|
||||
function isShape(s : Shapes): s is Shape {
|
||||
>isShape : Symbol(isShape, Decl(partiallyDiscriminantedUnions.ts, 33, 35))
|
||||
>s : Symbol(s, Decl(partiallyDiscriminantedUnions.ts, 35, 17))
|
||||
>Shapes : Symbol(Shapes, Decl(partiallyDiscriminantedUnions.ts, 32, 29))
|
||||
>s : Symbol(s, Decl(partiallyDiscriminantedUnions.ts, 35, 17))
|
||||
>Shape : Symbol(Shape, Decl(partiallyDiscriminantedUnions.ts, 30, 32))
|
||||
|
||||
return !Array.isArray(s);
|
||||
>Array.isArray : Symbol(ArrayConstructor.isArray, Decl(lib.d.ts, --, --))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>isArray : Symbol(ArrayConstructor.isArray, Decl(lib.d.ts, --, --))
|
||||
>s : Symbol(s, Decl(partiallyDiscriminantedUnions.ts, 35, 17))
|
||||
}
|
||||
|
||||
function fail(s: Shapes) {
|
||||
>fail : Symbol(fail, Decl(partiallyDiscriminantedUnions.ts, 37, 1))
|
||||
>s : Symbol(s, Decl(partiallyDiscriminantedUnions.ts, 39, 14))
|
||||
>Shapes : Symbol(Shapes, Decl(partiallyDiscriminantedUnions.ts, 32, 29))
|
||||
|
||||
if (isShape(s)) {
|
||||
>isShape : Symbol(isShape, Decl(partiallyDiscriminantedUnions.ts, 33, 35))
|
||||
>s : Symbol(s, Decl(partiallyDiscriminantedUnions.ts, 39, 14))
|
||||
|
||||
if (s.kind === "circle") {
|
||||
>s.kind : Symbol(kind, Decl(partiallyDiscriminantedUnions.ts, 29, 14), Decl(partiallyDiscriminantedUnions.ts, 30, 14))
|
||||
>s : Symbol(s, Decl(partiallyDiscriminantedUnions.ts, 39, 14))
|
||||
>kind : Symbol(kind, Decl(partiallyDiscriminantedUnions.ts, 29, 14), Decl(partiallyDiscriminantedUnions.ts, 30, 14))
|
||||
|
||||
let c: Circle = s;
|
||||
>c : Symbol(c, Decl(partiallyDiscriminantedUnions.ts, 42, 15))
|
||||
>Circle : Symbol(Circle, Decl(partiallyDiscriminantedUnions.ts, 29, 32))
|
||||
>s : Symbol(s, Decl(partiallyDiscriminantedUnions.ts, 39, 14))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
=== tests/cases/compiler/partiallyDiscriminantedUnions.ts ===
|
||||
// Repro from #10586
|
||||
|
||||
interface A1 {
|
||||
>A1 : A1
|
||||
|
||||
type: 'a';
|
||||
>type : "a"
|
||||
|
||||
subtype: 1;
|
||||
>subtype : 1
|
||||
}
|
||||
|
||||
interface A2 {
|
||||
>A2 : A2
|
||||
|
||||
type: 'a';
|
||||
>type : "a"
|
||||
|
||||
subtype: 2;
|
||||
>subtype : 2
|
||||
|
||||
foo: number;
|
||||
>foo : number
|
||||
}
|
||||
|
||||
interface B {
|
||||
>B : B
|
||||
|
||||
type: 'b';
|
||||
>type : "b"
|
||||
}
|
||||
|
||||
type AB = A1 | A2 | B;
|
||||
>AB : AB
|
||||
>A1 : A1
|
||||
>A2 : A2
|
||||
>B : B
|
||||
|
||||
const ab: AB = <AB>{};
|
||||
>ab : AB
|
||||
>AB : AB
|
||||
><AB>{} : AB
|
||||
>AB : AB
|
||||
>{} : {}
|
||||
|
||||
if (ab.type === 'a') {
|
||||
>ab.type === 'a' : boolean
|
||||
>ab.type : "a" | "b"
|
||||
>ab : AB
|
||||
>type : "a" | "b"
|
||||
>'a' : "a"
|
||||
|
||||
if (ab.subtype === 2) {
|
||||
>ab.subtype === 2 : boolean
|
||||
>ab.subtype : 1 | 2
|
||||
>ab : A1 | A2
|
||||
>subtype : 1 | 2
|
||||
>2 : 2
|
||||
|
||||
ab.foo;
|
||||
>ab.foo : number
|
||||
>ab : A2
|
||||
>foo : number
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #11185
|
||||
|
||||
class Square { kind: "square"; }
|
||||
>Square : Square
|
||||
>kind : "square"
|
||||
|
||||
class Circle { kind: "circle"; }
|
||||
>Circle : Circle
|
||||
>kind : "circle"
|
||||
|
||||
type Shape = Circle | Square;
|
||||
>Shape : Shape
|
||||
>Circle : Circle
|
||||
>Square : Square
|
||||
|
||||
type Shapes = Shape | Array<Shape>;
|
||||
>Shapes : Shapes
|
||||
>Shape : Shape
|
||||
>Array : T[]
|
||||
>Shape : Shape
|
||||
|
||||
function isShape(s : Shapes): s is Shape {
|
||||
>isShape : (s: Shapes) => s is Shape
|
||||
>s : Shapes
|
||||
>Shapes : Shapes
|
||||
>s : any
|
||||
>Shape : Shape
|
||||
|
||||
return !Array.isArray(s);
|
||||
>!Array.isArray(s) : boolean
|
||||
>Array.isArray(s) : boolean
|
||||
>Array.isArray : (arg: any) => arg is any[]
|
||||
>Array : ArrayConstructor
|
||||
>isArray : (arg: any) => arg is any[]
|
||||
>s : Shapes
|
||||
}
|
||||
|
||||
function fail(s: Shapes) {
|
||||
>fail : (s: Shapes) => void
|
||||
>s : Shapes
|
||||
>Shapes : Shapes
|
||||
|
||||
if (isShape(s)) {
|
||||
>isShape(s) : boolean
|
||||
>isShape : (s: Shapes) => s is Shape
|
||||
>s : Shapes
|
||||
|
||||
if (s.kind === "circle") {
|
||||
>s.kind === "circle" : boolean
|
||||
>s.kind : "square" | "circle"
|
||||
>s : Shape
|
||||
>kind : "square" | "circle"
|
||||
>"circle" : "circle"
|
||||
|
||||
let c: Circle = s;
|
||||
>c : Circle
|
||||
>Circle : Circle
|
||||
>s : Circle
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"scenario": "declarations_ExportNamespace",
|
||||
"projectRoot": "tests/cases/projects/declarations_ExportNamespace",
|
||||
"inputFiles": [
|
||||
"decl.d.ts",
|
||||
"useModule.ts"
|
||||
],
|
||||
"declaration": true,
|
||||
"baselineCheck": true,
|
||||
"emittedFiles": [
|
||||
"useModule.js",
|
||||
"useModule.d.ts"
|
||||
],
|
||||
"resolvedInputFiles": [
|
||||
"lib.d.ts",
|
||||
"decl.d.ts",
|
||||
"useModule.ts"
|
||||
]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user